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:
authorAntonio Vazquez <blendergit@gmail.com>2019-11-02 13:50:44 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-11-02 13:50:44 +0300
commit07968604ab190156bd0c931865bd133abd3bf745 (patch)
tree8d68ec1d11170f18d7a3c9c6d85d19fae8083e52 /source/blender/editors/gpencil
parent1c8d76772a84cb616c498ffbaf0a262086b0f8fa (diff)
GPencil: Some NULL checks missing in previous T71260 fix
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c5
-rw-r--r--source/blender/editors/gpencil/gpencil_utils.c5
2 files changed, 10 insertions, 0 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index bebdcb34326..c34e670c872 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -837,6 +837,11 @@ static short gp_stroke_addpoint(
gpd->runtime.sbuffer = ED_gpencil_sbuffer_ensure(
gpd->runtime.sbuffer, &gpd->runtime.sbuffer_size, &gpd->runtime.sbuffer_used, false);
+ /* Check the buffer was created. */
+ if (gpd->runtime.sbuffer == NULL) {
+ return GP_STROKEADD_INVALID;
+ }
+
/* get pointer to destination point */
pt = ((tGPspoint *)(gpd->runtime.sbuffer) + gpd->runtime.sbuffer_used);
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 3ca993673d4..91af444c28a 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2548,6 +2548,11 @@ tGPspoint *ED_gpencil_sbuffer_ensure(tGPspoint *buffer_array,
*buffer_size += GP_STROKE_BUFFER_CHUNK;
p = MEM_recallocN(buffer_array, sizeof(struct tGPspoint) * *buffer_size);
}
+
+ if (p == NULL) {
+ *buffer_size = *buffer_used = 0;
+ }
+
buffer_array = p;
}