inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
3.97k stars 482 forks source link

Unhandled exception on float division by zero #843

Open premek opened 1 year ago

premek commented 1 year ago

Inky version: 0.14.1 ink version: 1.1.1 inkjs version: 2.1.0

ink:

{1/0}

output:

Ink compiler had an unexpected error ☹

Unhandled exception. 
Ink compiler had an unexpected error ☹

System.Exception: Attempted to divide by zero. (Internal story path: 0.37)
 ---> System.DivideByZeroException: Attempted to divide by zero.
   at Ink.Runtime.NativeFunctionCall.<>c.b__50_3(Int32 x, Int32 y) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 334
   at Ink.Runtime.NativeFunctionCall.Call[T](List`1 parametersOfSingleType) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 148
   at Ink.Runtime.NativeFunctionCall.Call(List`1 parameters) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 112
   at Ink.Runtime.NativeFunctionCall.Call(List`1 parameters) in /Users/phish/inkle/projects/ink/ink-engine-runtime/NativeFunctionCall.cs:line 89
   at Ink.Runtime.Story.PerformLogicAndFlowControl(Object contentObj) in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 1695
   at Ink.Runtime.Story.Step() in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 898
   at Ink.Runtime.Story.ContinueSingleStep() in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 584
   at Ink.Runtime.Story.ContinueInternal(Single millisecsLimitAsync) in /Users/phish/inkle/projects/ink/ink-engine-runtime/Story.cs:line 462
   at Ink.CommandLinePlayer.EvaluateStory()
   at Ink.CommandLinePlayer.Begin() in /Users/phish/inkle/projects/ink/inklecate/CommandLinePlayer.cs:line 25
   at Ink.CommandLineTool..ctor(String[] args) in /Users/phish/inkle/projects/ink/inklecate/CommandLineTool.cs:line 194
   --- End of inner exception stack trace ---
   at Ink.CommandLineTool..ctor(String[] args) in /Users/phish/inkle/projects/ink/inklecate/CommandLineTool.cs:line 208
   at Ink.CommandLineTool.Main(String[] args) in /Users/phish/inkle/projects/ink/inklecate/CommandLineTool.cs:line 26

Compare with: ink:

{1.0/0}

out:

Infinity

ink:

{"a"/0}

out:

Line 15: Cannot perform operation '/' on String