From d621a99e733f135cb60dcb189806c66937348f99 Mon Sep 17 00:00:00 2001 From: Zhenqing Hu Date: Tue, 4 Sep 2018 14:35:57 -0400 Subject: [PATCH] To fix bug #12389, which is a validation for the potential null pointer. Signed-off-by: Zhenqing Hu --- modules/core/src/matrix_sparse.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/matrix_sparse.cpp b/modules/core/src/matrix_sparse.cpp index a2f061cab3..a37967c222 100644 --- a/modules/core/src/matrix_sparse.cpp +++ b/modules/core/src/matrix_sparse.cpp @@ -228,7 +228,7 @@ void SparseMat::create(int d, const int* _sizes, int _type) } } int _sizes_backup[CV_MAX_DIM]; // #5991 - if (_sizes == hdr->size) + if (hdr && _sizes == hdr->size) { for(int i = 0; i < d; i++ ) _sizes_backup[i] = _sizes[i];