mirror of
https://github.com/fadden/6502bench.git
synced 2024-09-06 01:55:11 +00:00
Fix adding header comment to project without header lines
The DisplayList update function was mis-handling the case where there were no previous lines. This caused assertions to fire for the case where you add a header comment to a project with no existing header comment or EQUs.
This commit is contained in:
parent
5deba9a898
commit
b5deea713f
@ -305,11 +305,13 @@ namespace SourceGen {
|
|||||||
" new=" + newCount + " (mList.Count=" + mList.Count + ")");
|
" new=" + newCount + " (mList.Count=" + mList.Count + ")");
|
||||||
|
|
||||||
Debug.Assert(startIndex >= 0 && startIndex < mList.Count);
|
Debug.Assert(startIndex >= 0 && startIndex < mList.Count);
|
||||||
Debug.Assert(oldCount > 0 && startIndex + oldCount <= mList.Count);
|
Debug.Assert(oldCount >= 0 && startIndex + oldCount <= mList.Count);
|
||||||
Debug.Assert(newCount >= 0);
|
Debug.Assert(newCount >= 0);
|
||||||
|
|
||||||
// Remove the old elements to clear them.
|
// Remove the old elements to clear them.
|
||||||
|
if (oldCount != 0) {
|
||||||
mList.RemoveRange(startIndex, oldCount);
|
mList.RemoveRange(startIndex, oldCount);
|
||||||
|
}
|
||||||
// Replace with the appropriate number of null entries.
|
// Replace with the appropriate number of null entries.
|
||||||
for (int i = 0; i < newCount; i++) {
|
for (int i = 0; i < newCount; i++) {
|
||||||
mList.Insert(startIndex, null);
|
mList.Insert(startIndex, null);
|
||||||
|
Loading…
Reference in New Issue
Block a user