From 11510a0e0bd07e1204efe4fccc3ab0592832d609 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Janiszewski?= Date: Tue, 7 May 2024 06:21:27 +0200 Subject: [PATCH] Guard against possible nullptr dereference when prefetching BBox (#21978) --- src/openrct2/paint/Paint.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/openrct2/paint/Paint.cpp b/src/openrct2/paint/Paint.cpp index 0fb4b9745a..ab2b7269f4 100644 --- a/src/openrct2/paint/Paint.cpp +++ b/src/openrct2/paint/Paint.cpp @@ -391,7 +391,10 @@ template static void PaintStructsSortQuadrant(PaintStruct* pa auto* ps = child; child = child->NextQuadrantEntry; - PREFETCH(&child->Bounds); + if (child != nullptr) + { + PREFETCH(&child->Bounds); + } if (child == nullptr || child->SortFlags & PaintSortFlags::OutsideQuadrant) { break;