Skip to content

IndexOutOfRangeExceptions in 2018.3.x #17

@kersk

Description

@kersk

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!

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions