diff --git a/gtk/gtkimage.c b/gtk/gtkimage.c
index 5763f06..032100d 100644
--- a/gtk/gtkimage.c
+++ b/gtk/gtkimage.c
@@ -1015,8 +1015,6 @@ gtk_image_set_from_resource (GtkImage    *image,
       return;
     }

-  priv->resource_path = g_strdup (resource_path);
-
   if (gdk_pixbuf_animation_is_static_image (animation))
     gtk_image_set_from_pixbuf (image, gdk_pixbuf_animation_get_static_image (animation));
   else
@@ -1024,6 +1022,8 @@ gtk_image_set_from_resource (GtkImage    *image,

   _gtk_icon_helper_set_pixbuf_scale (priv->icon_helper, scale_factor);

+  priv->resource_path = g_strdup (resource_path);
+
   g_object_notify (G_OBJECT (image), "resource");

   g_object_unref (animation);
