[gimp/wip/animation: 173/197] plug-ins: fix camera keyframe creation.



commit 21a32a7b992f297a6c85e89ab50cdc3995799321
Author: Jehan <jehan girinstud io>
Date:   Tue Jun 27 00:57:56 2017 +0200

    plug-ins: fix camera keyframe creation.
    
    I needed to test for the list item, not the data, which may be NULL even
    when the item is there.

 plug-ins/animation-play/core/animation-camera.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
---
diff --git a/plug-ins/animation-play/core/animation-camera.c b/plug-ins/animation-play/core/animation-camera.c
index d84cfdf..275085e 100644
--- a/plug-ins/animation-play/core/animation-camera.c
+++ b/plug-ins/animation-play/core/animation-camera.c
@@ -206,14 +206,15 @@ animation_camera_set_keyframe (AnimationCamera *camera,
                                gint             x,
                                gint             y)
 {
+  GList  *iter;
   Offset *offset;
 
   g_return_if_fail (position >= 0 &&
                     position < animation_get_duration (camera->priv->animation));
 
-  offset = g_list_nth_data (camera->priv->offsets, position);
+  iter = g_list_nth (camera->priv->offsets, position);
 
-  if (! offset)
+  if (! iter)
     {
       gint length = g_list_length (camera->priv->offsets);
       gint i;
@@ -225,6 +226,14 @@ animation_camera_set_keyframe (AnimationCamera *camera,
       offset = g_new (Offset, 1);
       camera->priv->offsets = g_list_append (camera->priv->offsets, offset);
     }
+  else
+    {
+      if (! iter->data)
+        {
+          iter->data = g_new (Offset, 1);
+        }
+      offset = iter->data;
+    }
 
   offset->x = x;
   offset->y = y;


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