diff --git a/uppsrc/Core/Util.h b/uppsrc/Core/Util.h index b1b737b2d..d819e678f 100644 --- a/uppsrc/Core/Util.h +++ b/uppsrc/Core/Util.h @@ -404,6 +404,8 @@ public: // ------------------- Advanced streaming -------------------- +void CheckedSerialize(const Callback1 serialize, Stream& stream, int version = Null); + bool Load(Callback1 serialize, Stream& stream, int version = Null); bool Store(Callback1 serialize, Stream& stream, int version = Null); bool LoadFromFile(Callback1 serialize, const char *file = NULL, int version = Null); diff --git a/uppsrc/Core/Value.hpp b/uppsrc/Core/Value.hpp index 816a0d3a8..d7adfeb3f 100644 --- a/uppsrc/Core/Value.hpp +++ b/uppsrc/Core/Value.hpp @@ -244,11 +244,9 @@ inline const T& Value::To() const if(x) return x->Get(); } - else { - ASSERT(t < 255); - if(Is((byte)t)) - return GetSmallRaw(); - } + else + if(t < 255 && Is((byte)t)) + return GetSmallRaw(); throw ValueTypeError(String().Cat() << "Invalid value conversion: " << GetName() << " -> " << typeid(T).name(), *this, t);