[gimp] libgimpconfig: fix precondition checks in gimp_config_type_register()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpconfig: fix precondition checks in gimp_config_type_register()
- Date: Thu, 19 Sep 2019 22:40:42 +0000 (UTC)
commit 31bf04a61058e12c47d7b8605a8820bd8b94efcb
Author: Michael Natterer <mitch gimp org>
Date: Fri Sep 20 00:35:56 2019 +0200
libgimpconfig: fix precondition checks in gimp_config_type_register()
check for zero pspecs or more than zero pspecs, but consistently check
both pspecs and n_pspecs.
libgimpconfig/gimpconfig-register.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/libgimpconfig/gimpconfig-register.c b/libgimpconfig/gimpconfig-register.c
index 4fb0154839..d621f726e2 100644
--- a/libgimpconfig/gimpconfig-register.c
+++ b/libgimpconfig/gimpconfig-register.c
@@ -83,7 +83,8 @@ gimp_config_type_register (GType parent_type,
g_return_val_if_fail (g_type_is_a (parent_type, G_TYPE_OBJECT), G_TYPE_NONE);
g_return_val_if_fail (type_name != NULL, G_TYPE_NONE);
- g_return_val_if_fail (pspecs != NULL, G_TYPE_NONE);
+ g_return_val_if_fail ((pspecs == NULL && n_pspecs == 0) ||
+ (pspecs != NULL && n_pspecs > 0), G_TYPE_NONE);
terminated_pspecs = g_new0 (GParamSpec *, n_pspecs + 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]