Page 1 of 1

Bug when Adding Point and hitting Undo at the same time

Posted: Mon Feb 18, 2019 4:49 pm
by DrNibbert
Hello,

i produced an interessting Error today:
I was in the Add Point-Tool (Auto-Weld, Auto-Fill, Auto-Stroke, Sharp Corners - All settings enabled) and was click-dragging to create a new line, while at the same time pressing Cmd+Z to undo the Point i did before, while still holding the Left Mouse Button Pressed. This resulted in the Colsole popping up and spitting out the error-message
M_Mesh:Point - out of range
...Contents/Ressources/Support/scripts/tool/lm_add_point.lua:319: attempt to index a nil value
over and over.

i had to quit and restart Moho to continue working.

I was able to reproduce this error in a new Project with the same settings.

Re: Bug when Adding Point and hitting Undo at the same time

Posted: Mon Feb 18, 2019 5:47 pm
by synthsin75
The tool has to count through all the points to find the one to connect to and the one you're adding (while you're deciding where to place it). If you hit undo in the middle of a mouse operation, you are changing the number of points, and functions that expect that number to remain valid throw errors.

If someone were to try to account for the user hitting undo in the middle of a mouse operation, it would require more processing while you're moving the mouse, which would likely make it slower to respond, especially with more points on the layer. There's nothing that hitting undo in the middle of a mouse operation can do that just waiting til after you let off the mouse button can't. So refraining from doing that is a small price to pay for a tool that responds quickly and smoothly.

If the error keeps repeating either change tools, hit undo again, or add a new point. Then the error will stop repeating and you can just close the Lua Console and continue working, without quitting Moho. That error is not a danger to your file.

Re: Bug when Adding Point and hitting Undo at the same time

Posted: Wed Feb 20, 2019 10:21 am
by DrNibbert
Thanks! Wasn't really a big problem for me, just wanted to bring it to everyones attention so maybe this can be fixed in a future update :-)

Re: Bug when Adding Point and hitting Undo at the same time

Posted: Wed Feb 20, 2019 4:30 pm
by synthsin75
Actually, with a little further thought, this could be fixed without impacting performance: https://sites.google.com/site/synthsin/ ... ects=0&d=1

I'll report it, and this fix, to the devs.

Re: Bug when Adding Point and hitting Undo at the same time

Posted: Thu Feb 21, 2019 8:58 am
by DrNibbert
Awesome :-) I feel like every tiny addition makes Moho better and better every day :D