Code

OCAL. Fix for Bug #638844 (Errors printed to console if openclipart search fails).
[inkscape.git] / src / color.cpp
index 6b2281f2697457dde841dd58e3dc5391f7df25aa..54af89ae5d5c92665b458a5cf5666d11179a7d5b 100644 (file)
@@ -63,14 +63,15 @@ SPColor::~SPColor()
 
 SPColor& SPColor::operator= (SPColor const& other)
 {
-    SVGICCColor* tmp = other.icc ? new SVGICCColor(*other.icc) : 0;
+    SVGICCColor* tmp_icc = other.icc ? new SVGICCColor(*other.icc) : 0;
+
     v.c[0] = other.v.c[0];
     v.c[1] = other.v.c[1];
     v.c[2] = other.v.c[2];
     if ( icc ) {
         delete icc;
     }
-    icc = tmp;
+    icc = tmp_icc;
 
     return *this;
 }
@@ -191,16 +192,18 @@ std::string SPColor::toString() const
     sp_svg_write_color(tmp, sizeof(tmp), toRGBA32(0x0ff));
     css << tmp;
 
-    if ( !css.str().empty() ) {
-        css << " ";
-    }
-    css << "icc-color(" << icc->colorProfile;
-    for (vector<double>::const_iterator i(icc->colors.begin()),
-             iEnd(icc->colors.end());
-         i != iEnd; ++i) {
-        css << ", " << *i;
+    if ( icc ) {
+        if ( !css.str().empty() ) {
+            css << " ";
+        }
+        css << "icc-color(" << icc->colorProfile;
+        for (vector<double>::const_iterator i(icc->colors.begin()),
+                 iEnd(icc->colors.end());
+             i != iEnd; ++i) {
+            css << ", " << *i;
+        }
+        css << ')';
     }
-    css << ')';
 
     return css.str();
 }
@@ -449,4 +452,4 @@ sp_color_cmyk_to_rgb_floatv (float *rgb, float c, float m, float y, float k)
   fill-column:99
   End:
 */
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :