[gimp/wip/animation: 110/182] plug-ins: animation_animatic_get_frame() can return NULL on empty cache.



commit afaeec58bcd97568ae4166db2951face1488139d
Author: Jehan <jehan girinstud io>
Date:   Sun Jan 1 21:09:03 2017 +0100

    plug-ins: animation_animatic_get_frame() can return NULL on empty cache.
    
    We should only g_object_ref() if the cache has contents.

 plug-ins/animation-play/core/animation-animatic.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-animatic.c 
b/plug-ins/animation-play/core/animation-animatic.c
index 790549b..c91152b 100644
--- a/plug-ins/animation-play/core/animation-animatic.c
+++ b/plug-ins/animation-play/core/animation-animatic.c
@@ -388,12 +388,16 @@ animation_animatic_get_frame (Animation *animation,
                               gint       pos)
 {
   AnimationAnimaticPrivate *priv;
+  GeglBuffer               *frame = NULL;
   gint                      panel;
 
   priv = GET_PRIVATE (animation);
   panel = animation_animatic_get_panel (ANIMATION_ANIMATIC (animation),
                                         pos);
-  return g_object_ref (priv->cache[panel]);
+  if (priv->cache[panel])
+    frame = g_object_ref (priv->cache[panel]);
+
+  return frame;
 }
 
 static gboolean


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]