Don't try to write object if LcfSize is 0
MODIFY
src/reader_struct.cpp
src/reader_struct.cpp
@@ -122,9 +122,12 @@ void Struct<S>::WriteLcf(const S& obj, LcfWriter& stream) {
continue;
}
stream.WriteInt(field->id);
- stream.WriteInt(field->LcfSize(obj, stream));
+ auto len = field->LcfSize(obj, stream);
+ stream.WriteInt(len);
+ if (len > 0) {
field->WriteLcf(obj, stream);
}
+ }
// Writing a 0-byte after RPG::Database or RPG::Save breaks the parser in RPG_RT
conditional_zero_writer<S>(stream);
}

Don't try to write object if LcfSize is 0