mirror of
https://github.com/DrBeef/Raze.git
synced 2025-02-20 18:52:43 +00:00
- handle edge case in clipper where adding a new window will remove the entire clipper's content before adding the new range.
This case would have passed the actual logic but not the asserts.
This commit is contained in:
parent
04f3268893
commit
50bad91f14
1 changed files with 13 additions and 9 deletions
|
@ -562,17 +562,21 @@ void Clipper::AddWindowRange(int start, int end, float topclip, float bottomclip
|
|||
node = next;
|
||||
}
|
||||
|
||||
// we get here if a new range needs to be inserted.
|
||||
node = cliphead;
|
||||
// advance to the place where this can be inserted.
|
||||
while (node != nullptr && node->start < end)
|
||||
// cliphead *can* be null here if a sole existing older range got removed because this one covers it entirely.
|
||||
if (cliphead)
|
||||
{
|
||||
prevNode = node;
|
||||
node = node->next;
|
||||
// we get here if a new range needs to be inserted.
|
||||
node = cliphead;
|
||||
// advance to the place where this can be inserted.
|
||||
while (node != nullptr && node->start < end)
|
||||
{
|
||||
prevNode = node;
|
||||
node = node->next;
|
||||
}
|
||||
assert(!prevNode || prevNode->end <= start);
|
||||
assert(!prevNode || !prevNode->next || prevNode->next->start >= end);
|
||||
assert(prevNode || (cliphead && (!cliphead->next || cliphead->next->start >= end)));
|
||||
}
|
||||
assert(!prevNode || prevNode->end <= start);
|
||||
assert(!prevNode || !prevNode->next || prevNode->next->start >= end);
|
||||
assert(prevNode || (cliphead && (!cliphead->next || cliphead->next->start >= end)));
|
||||
}
|
||||
|
||||
if (topclip > viewz) topclip = FLT_MAX;
|
||||
|
|
Loading…
Reference in a new issue