1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-06-24 08:29:29 +00:00

Fix Actions menu crash

If you open the Actions menu when nothing is selected, the "can I
create a local variable table here" method crashes with a bad index
reference.

Issue #48.
This commit is contained in:
Andy McFadden 2019-10-01 19:13:15 -07:00
parent 14150af004
commit e2b5b12e13

View File

@ -1650,8 +1650,11 @@ namespace SourceGen {
}
public bool CanCreateLocalVariableTable() {
int selIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
if (SelectionAnalysis.mNumItemsSelected != 1) {
return false;
}
// Only allow on code lines. This is somewhat arbitrary; data would work fine.
int selIndex = mMainWin.CodeListView_GetFirstSelectedIndex();
if (CodeLineList[selIndex].LineType != LineListGen.Line.Type.Code) {
return false;
}