question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property '0' of undefined

See original GitHub issue

Hi, I’ve been working on a whiteboard project and use perfect-arrow to draw connections. However, although 99% of the time the arrows render perfectly, there are sometimes the app crashed and gave me this error message. Through the debugging process I’m pretty sure the pos and rect information are successfully passed into the getBoxToBoxArrow function. Do you have any idea what might cause this problem? Thanks!

getBoxToBoxArrow
src/lib/getBoxToBoxArrow.ts:254

251 |     ph1,
252 |     padEnd
253 |   )
> 254 | } else {
255 | ^ // Calculate an angle based on distance, overlap and intermediacy 256 | const distOffset1 = modulate(distEffect, [0.75, 1], [0, 1], true) 257 |
src/components/WhiteBoard/SpaceView.js:562
559 | const end = whiteBoardData.cardInstances.find(
560 |     cardInstance => cardInstance.cardInstanceId === connection.toCardInstanceId
561 | );
> 562 | const arrowData = getBoxToBoxArrow(
563 | begin.pos.x,
564 | begin.pos.y,
565 | begin.rect.width,

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
Scya597commented, Jun 10, 2021

Here’s how to reproduce the bug:

getBoxToBoxArrow(-4710.06155657891, -1571.6917781196591, 545.7397072097903, 457.4198639994165, -5335.457377534619, -768.3931456842388, 559.06478024143, 358.2843535608206)
0reactions
Scya597commented, Jun 25, 2021

@steveruizok It seems like now this new value will cause the app crash. Can you fix it?

getBoxToBoxArrow(-3310.4745592182676, -4304.482108365398, 680, 370, -3466.9797415827898 ,-3752.7479966580413, 335.242707362754, 272.9783899410915)
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix Cannot read Property '0' of Undefined in JS
The Solution · Ensure you are using the correct variable · Perform a simple check on your variable before using it to make...
Read more >
How to Prevent the Error: Cannot Read Property '0' of Undefined
If a property of an object is an array, it's possible to accidentally misspell the key or try to access the array through...
Read more >
Fix: Cannot Read Property '0' of Undefined - Coding Beauty
The “cannot read property '0' of undefined” error occurs when you try to access the 0 index of an array-like variable, but the...
Read more >
TypeError: Cannot read Property '0' of Undefined in JS
The "Cannot read property '0' of undefined" error occurs when trying to access the 0th index in a variable that stores an undefined...
Read more >
Javascript Uncaught TypeError: Cannot read property '0' of ...
which means that, when you try to access d[ascii] , you are actually trying to access undefined[0] , hence the error.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found