1
0
mirror of https://github.com/fadden/6502bench.git synced 2024-05-31 22:41:37 +00:00

Fix crash

The code that sets and removes analyzer tags allows you to select a
mix of lines.  If the mix included the header comment, the negative
file offset would cause a crash.
This commit is contained in:
Andy McFadden 2021-11-13 15:45:49 -08:00
parent d597c386c7
commit 75a86fbbc3

View File

@ -2435,7 +2435,7 @@ namespace SourceGen {
return false;
}
EntityCounts counts = SelectionAnalysis.mEntityCounts;
// Single line, must be a visualization set.
// Single line, must be a visualization set or a place where one can be created.
LineListGen.Line.Type lineType = SelectionAnalysis.mLineType;
return (lineType == LineListGen.Line.Type.VisualizationSet ||
lineType == LineListGen.Line.Type.Code ||
@ -3402,16 +3402,20 @@ namespace SourceGen {
return false;
}
private bool mUpdatingSelectionHighlight; // recursion guard
private bool mUpdatingSelectionHighlight; // recursion guard for next method
/// <summary>
/// Updates the selection highlight. When a code item with an operand offset is
/// selected, such as a branch, we want to highlight the address and label of the
/// target.
/// </summary>
private void UpdateSelectionHighlight() {
int targetIndex = FindSelectionHighlight();
if (mUpdatingSelectionHighlight) {
return;
}
if (mTargetHighlightIndex != targetIndex && !mUpdatingSelectionHighlight) {
int targetIndex = FindSelectionHighlight();
if (mTargetHighlightIndex != targetIndex) {
Debug.WriteLine("Target highlight moving from " + mTargetHighlightIndex +
" to " + targetIndex);
@ -3573,6 +3577,10 @@ namespace SourceGen {
continue;
}
int offset = CodeLineList[index].FileOffset;
if (offset < 0) {
// Ignore file header comment and EQU lines.
continue;
}
// Mark every byte of an instruction or multi-byte data item --
// everything that is represented by the line the user selected.