Check that error exists before trying to set it. Fixes bug #640975.
authorIgnacio Casal Quinteiro <icq@gnome.org>
Mon, 31 Jan 2011 12:34:26 +0000 (13:34 +0100)
committerIgnacio Casal Quinteiro <icq@gnome.org>
Mon, 31 Jan 2011 12:34:26 +0000 (13:34 +0100)
glib/gconvert.c

index 52a3dd8..b363bca 100644 (file)
@@ -769,13 +769,14 @@ g_convert_with_iconv (const gchar *str,
              have_error = TRUE;
              break;
            default:
-              {
-                int errsv = errno;
-                
-                g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
-                             _("Error during conversion: %s"),
-                             g_strerror (errsv));
-              }
+             if (error)
+                {
+                  int errsv = errno;
+
+                  g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_FAILED,
+                               _("Error during conversion: %s"),
+                               g_strerror (errsv));
+                }
              have_error = TRUE;
              break;
            }