1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-07-06 16:29:03 +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 7ddde3aad7
commit 6c102919f5

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;
}