Commit f2fc7e0a authored by twanvl's avatar twanvl

fixed nullptr exception when opening a stylesheet without a game twice, the...

fixed nullptr exception when opening a stylesheet without a game twice, the solution is to re-load when loading/validating fails the first time
parent 973a3381
...@@ -556,11 +556,11 @@ void Packaged::open(const String& package, bool just_header) { ...@@ -556,11 +556,11 @@ void Packaged::open(const String& package, bool just_header) {
} }
void Packaged::loadFully() { void Packaged::loadFully() {
if (fully_loaded) return; if (fully_loaded) return;
fully_loaded = true;
Reader reader(openIn(typeName()), this, absoluteFilename() + _("/") + typeName()); Reader reader(openIn(typeName()), this, absoluteFilename() + _("/") + typeName());
try { try {
reader.handle_greedy(*this); reader.handle_greedy(*this);
validate(reader.file_app_version); validate(reader.file_app_version);
fully_loaded = true; // only after loading and validating succeeded, be careful with recursion!
} catch (const ParseError& err) { } catch (const ParseError& err) {
throw FileParseError(err.what(), absoluteFilename() + _("/") + typeName()); // more detailed message throw FileParseError(err.what(), absoluteFilename() + _("/") + typeName()); // more detailed message
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment