Fix null dereference when stylesheets are missing, added an error message

This commit is contained in:
Twan van Laarhoven
2020-05-09 13:31:42 +02:00
parent 968b8eabca
commit 0a0dd72e36
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -35,6 +35,7 @@ StyleSheetP StyleSheet::byGameAndName(const Game& game, const String& name) {
return package_manager.open<StyleSheet>(full_name);
}
} catch (PackageNotFoundError& e) {
queue_message(MESSAGE_ERROR, _("Missing stylesheet: ") + full_name);
if (stylesheet_for_reading()) {
// we already have a stylesheet higher up, so just return a null pointer
return StyleSheetP();
+2
View File
@@ -196,6 +196,8 @@ template <typename T>
inline void after_reading(intrusive_ptr<T>& x, Version ver) {
after_reading(*x, ver);
}
inline void after_reading(GameP&, Version) {}
inline void after_reading(StyleSheetP&, Version) {}
// ----------------------------------------------------------------------------- : Container types