From 932ab442403e4007b7dfb8e4c587e5d979379df1 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Mon, 13 Oct 2014 10:05:35 +0200 Subject: Fix: "Forming reference to null pointer" (bzr r13606) --- src/style-internal.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/style-internal.cpp') diff --git a/src/style-internal.cpp b/src/style-internal.cpp index a55a11403..f8a4a43f7 100644 --- a/src/style-internal.cpp +++ b/src/style-internal.cpp @@ -981,7 +981,16 @@ SPIPaint::read( gchar const *str ) { if (streq(str, "currentColor")) { set = true; currentcolor = true; - setColor( style->color.value.color ); + if (style) { + setColor( style->color.value.color ); + } else { + // Normally an SPIPaint is part of an SPStyle and the value of 'color' is + // available. SPIPaint can be used 'stand-alone' (e.g. to parse color values) in + // which case a value of 'currentColor' is meaningless, thus we shouldn't reach + // here. + std::cerr << "SPIPaint::read(): value is 'currentColor' but 'color' not available." << std::endl; + setColor( 0 ); + } } else if (streq(str, "none")) { set = true; noneSet = true; -- cgit v1.2.3