From c46e86f4161dbf1f55b96bea02268b28ea856c6d Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 14 Dec 2020 10:21:06 -0800 Subject: [PATCH] Error checking for ShowCode --- IDE/src/IDEApp.bf | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index dc77daa1..2d528b57 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -1054,15 +1054,17 @@ namespace IDE if (var sourceViewPanel = GetActiveSourceViewPanel(true)) sourceViewPanel.RecordHistoryLocation(); - int32 char8Idx = int32.Parse(cmds[2]).GetValueOrDefault(); + int32 charIdx = int32.Parse(cmds[2]).GetValueOrDefault(); + if (charIdx < 0) + return; var sourceViewPanel = ShowSourceFile(cmds[1], null, SourceShowType.Temp); if (sourceViewPanel == null) return; var editWidgetContent = sourceViewPanel.mEditWidget.mEditWidgetContent; int line; int lineChar; - editWidgetContent.GetLineCharAtIdx(char8Idx, out line, out lineChar); - sourceViewPanel.ShowFileLocation(char8Idx, .Always); + editWidgetContent.GetLineCharAtIdx(charIdx, out line, out lineChar); + sourceViewPanel.ShowFileLocation(charIdx, .Always); case "ShowCodeAddr": var sourceViewPanel = GetActiveSourceViewPanel(true); if (sourceViewPanel != null)