Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2015-04-17 04:32:57 +0300
committerJoshua Leung <aligorith@gmail.com>2015-04-17 04:32:57 +0300
commit09f2aa938248bedebf7e801fabd833055627fe46 (patch)
tree6abc95bcc3538b82708d83892eafdcceeacf90b2 /source/blender/blenkernel/intern
parent582fa5e36e031e08b2af39d055ac6790a12941ee (diff)
Fix T44412: Crash when trying to paint on a GPencil frame when the frames are out of order
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index ba4077ed70a..38a84296ca6 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -129,7 +129,7 @@ void BKE_gpencil_free(bGPdata *gpd)
/* add a new gp-frame to the given layer */
bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
{
- bGPDframe *gpf, *gf;
+ bGPDframe *gpf = NULL, *gf = NULL;
short state = 0;
/* error checking (neg frame only if they are not allowed in Blender!) */
@@ -160,8 +160,14 @@ bGPDframe *gpencil_frame_addnew(bGPDlayer *gpl, int cframe)
/* check whether frame was added successfully */
if (state == -1) {
+ printf("Error: Frame (%d) existed already for this layer. Using existing frame\n", cframe);
+
+ /* free the newly created one, and use the old one instead */
MEM_freeN(gpf);
- printf("Error: frame (%d) existed already for this layer\n", cframe);
+
+ /* return existing frame instead... */
+ BLI_assert(gf != NULL);
+ gpf = gf;
}
else if (state == 0) {
/* add to end then! */