hecomi / uREPL

In-game powerful REPL environment for Unity3D.
http://tips.hecomi.com/entry/2015/12/05/003000
MIT License
551 stars 54 forks source link

IndexOutOfRangeExceptions in 2018.3.x #17

Closed kersk closed 5 years ago

kersk commented 5 years ago

Great asset! However, I hit a minor bug when testing this in 2018.3.x. When entering any text in the console, it would intermittently throw the following IndexOutOfRangeException:

IndexOutOfRangeException: Index was outside the bounds of the array.
uREPL.Completion+<>c__DisplayClass11_0.<Start>b__0 () (at Assets/External/uREPL/Scripts/Core/Completion.cs:44)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <ac823e2bb42b41bda67924a45a0173c3>:0)
System.Threading.ThreadHelper.ThreadStart () (at <ac823e2bb42b41bda67924a45a0173c3>:0)
UnityEngine.UnhandledExceptionHandler:<RegisterUECatcher>m__0(Object, UnhandledExceptionEventArgs)

I worked around it by modifying Completion.cs @ line 44:

- result_.partialCode = completions[0].prefix : "";
+ result_.partialCode = (completions != null && completions.Length > 0) ? completions[0].prefix : "";

That seems to avoid the issue. Thanks!

slimshader commented 5 years ago

Will this be fixed? Is new Release coming?

hecomi commented 5 years ago

Sorry for my late work..., I've fixed this problem in v0.6.0. Thank you very much for the report. https://github.com/hecomi/uREPL/releases/tag/v0.6.0