summaryrefslogtreecommitdiffstats
path: root/src/style-internal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/style-internal.cpp')
-rw-r--r--src/style-internal.cpp26
1 files changed, 22 insertions, 4 deletions
diff --git a/src/style-internal.cpp b/src/style-internal.cpp
index a55a11403..a81a2799d 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;
@@ -1396,11 +1405,20 @@ SPIFilter::read( gchar const *str ) {
set = true;
// Create href if not already done.
- if (!href && style->object) {
- href = new SPFilterReference(style->object);
- href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_filter_ref_changed), style));
+ if (!href) {
+ if (style->object) {
+ href = new SPFilterReference(style->object);
+ }
+ // Do we have href now?
+ if ( href ) {
+ href->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_style_filter_ref_changed), style));
+ } else {
+ std::cerr << "SPIFilter::read(): Could not allocate 'href'" << std::endl;
+ return;
+ }
}
+ // We have href
try {
href->attach(Inkscape::URI(uri));
} catch (Inkscape::BadURIException &e) {