Page 1 of 1

division by 0 or null, modulo 0 or null ...

Posted: 02 Nov 2014 13:28
by Bushmills
don't throw exceptions. I believe they ought to.
I haven't tested with square root of negative numbers, but assume the same to be the case.

Re: division by 0 or null, modulo 0 or null ...

Posted: 03 Nov 2014 20:32
by Martin
a=1/0;
a=1/null;
a=1%0;
a=1%null;
throw exceptions for me.

Re: division by 0 or null, modulo 0 or null ...

Posted: 05 Nov 2014 15:12
by Bushmills
Very strange - for the flow posted in feature request putElement, I was specifically looking for a simple exception throwing instruction, to break out of an infinite loop (action VM or Virtual Machine) - so I tried several, starting with the most obvious ones, like division by zero. Within that trial and error session, I arrived at "not 0" which worked for me.
Meanwhile I have edited it to say "not good" for added syntactical icing. There is a possibility that I came across another problem, reported in eval with curly braces, which made me believe that these operations wouldn't throw exceptions - while in reality they were never executed.

Re: division by 0 or null, modulo 0 or null ...

Posted: 08 Nov 2014 20:14
by Bushmills
Another reason for not getting those exceptions may have been that it is possible to jam them.
Please refer to the accompanying flow, following these instructions:

after importing, execute it, no matter whether enabled or kept disabled.
Wait until the flow aborts because of execution limit.
Immediately execute the flow again, without enabling it. Watch its execution.

The scenario may be contrived, but the observation of not throwing the exception after second start may point to a real problem.

http://automagic4android.com/flow.php?i ... 72a610b1a7

Re: division by 0 or null, modulo 0 or null ...

Posted: 10 Nov 2014 16:17
by Martin
Interesting observation! It's caused when the flow is executed manually and reaches the emergency stop count. The internal execution counter is not reset when you directly start the flow again without enabling the flow first so it will immediately halt execution on the first action but will miss to show the notification about the emergency stop. I think it should be save to reset the internal counter when a flow is executed manually. This should be fixed in the next build.