diff --git a/Common/Serialize/SerializeFuncs.h b/Common/Serialize/SerializeFuncs.h index c8c8eb4b33..49fcded674 100644 --- a/Common/Serialize/SerializeFuncs.h +++ b/Common/Serialize/SerializeFuncs.h @@ -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); }