mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-01 14:58:14 +00:00
Serialize: Don't dereference unfilled pointers after a load fails
Containers of pointers are filled with nullptr and then DoClass'd, and once an error switches the load to MODE_NOOP, every remaining element called DoState on null. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
d6c74156b1
commit
7fa6be6a25
1 file changed
+5
@@ -66,6 +66,9 @@ void DoClass(PointerWrap &p, T *&x) {
|
||||
if (p.mode == PointerWrap::MODE_READ) {
|
||||
delete x;
|
||||
x = new T();
|
||||
} else if (p.mode == PointerWrap::MODE_NOOP && !x) {
|
||||
// A load that failed partway leaves the rest of a container unfilled.
|
||||
return;
|
||||
}
|
||||
x->DoState(p);
|
||||
}
|
||||
@@ -76,6 +79,8 @@ void DoSubClass(PointerWrap &p, T *&x, Args... args) {
|
||||
if (x != nullptr)
|
||||
delete x;
|
||||
x = new S(args...);
|
||||
} else if (p.mode == PointerWrap::MODE_NOOP && !x) {
|
||||
return;
|
||||
}
|
||||
x->DoState(p);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user