Skip to content

Commit d98d4b4

Browse files
committed
a bunch of tiny fixes i noticed; one in particular seemed to cause a crash sometimes
1 parent 717d810 commit d98d4b4

File tree

5 files changed

+11
-6
lines changed

5 files changed

+11
-6
lines changed

Runtime/Commands/Actions.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ public CommandDispatchResult.ParameterParseStatusType TryParseArgs(string[] args
222222
arg = args[i];
223223
if (converter == null)
224224
{
225-
paramsArray.SetValue(arg, i);
225+
// Use relative index into paramsArray
226+
paramsArray.SetValue(arg, i - paramIndex);
226227
}
227228
else
228229
{

Runtime/LineProviders/UnityLocalisedLineProvider.Installed.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public string? ShadowLineSource
4444
{
4545
foreach (var metadataEntry in tags)
4646
{
47-
if (metadataEntry.StartsWith("shadow:") != false)
47+
if (metadataEntry.StartsWith("shadow:"))
4848
{
4949
// This is a shadow line. Return the line ID that it's
5050
// shadowing.

Runtime/Storage/InMemoryVariableStorage.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,11 @@ public string GetDebugList()
7171
var stringBuilder = new System.Text.StringBuilder();
7272
foreach (KeyValuePair<string, object> item in variables)
7373
{
74+
// .Name gets type name without namespace prefix
7475
stringBuilder.AppendLine(string.Format("{0} = {1} ({2})",
7576
item.Key,
7677
item.Value.ToString(),
77-
variableTypes[item.Key].ToString().Substring("System.".Length)));
78+
variableTypes[item.Key].Name));
7879
}
7980
return stringBuilder.ToString();
8081
}

Runtime/Views/OptionsPresenter.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,11 @@ async YarnTask CancelSourceWhenDialogueCancelled()
303303
{
304304
// we get the substring of 0 -> markup position
305305
// and replace that range with ...
306-
var end = lineText.Substring(markup.Position);
307-
lineText = "..." + end;
306+
if (markup.Position <= lineText.Length) // Bounds check
307+
{
308+
var end = lineText.Substring(markup.Position);
309+
lineText = "..." + end;
310+
}
308311
}
309312

310313
if (lastLineText != null)

Runtime/YarnProject/LineMetadata.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public IEnumerable<string> GetLineIDs()
9090

9191
foreach (var metadataEntry in metadata)
9292
{
93-
if (metadataEntry.StartsWith("shadow:") != false)
93+
if (metadataEntry.StartsWith("shadow:"))
9494
{
9595
// This is a shadow line. Return the line ID that it's
9696
// shadowing.

0 commit comments

Comments
 (0)