From 0a0dd72e368cdd2db655736e5557f94878001692 Mon Sep 17 00:00:00 2001 From: Twan van Laarhoven Date: Sat, 9 May 2020 13:31:42 +0200 Subject: [PATCH] Fix null dereference when stylesheets are missing, added an error message --- src/data/stylesheet.cpp | 1 + src/util/io/reader.hpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/src/data/stylesheet.cpp b/src/data/stylesheet.cpp index 4acf27f0..5da65996 100644 --- a/src/data/stylesheet.cpp +++ b/src/data/stylesheet.cpp @@ -35,6 +35,7 @@ StyleSheetP StyleSheet::byGameAndName(const Game& game, const String& name) { return package_manager.open(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(); diff --git a/src/util/io/reader.hpp b/src/util/io/reader.hpp index c2eda096..f35ebab3 100644 --- a/src/util/io/reader.hpp +++ b/src/util/io/reader.hpp @@ -196,6 +196,8 @@ template inline void after_reading(intrusive_ptr& x, Version ver) { after_reading(*x, ver); } +inline void after_reading(GameP&, Version) {} +inline void after_reading(StyleSheetP&, Version) {} // ----------------------------------------------------------------------------- : Container types