From 52c0bf3d116ca8bc1d0b77b51dbe253ce9b32688 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Wed, 10 Feb 2010 20:08:28 -0800 Subject: [PATCH] gui: Fix null pointer dereference in get_object_assert(). This function was checking whether o == NULL and then blindly dereferencing it after it found it to be so. Found by Clang (http://clang-analyzer.llvm.org). --- src/ui/gui/helper.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ui/gui/helper.c b/src/ui/gui/helper.c index 377f17a7..44396663 100644 --- a/src/ui/gui/helper.c +++ b/src/ui/gui/helper.c @@ -1,5 +1,5 @@ /* PSPPIRE - a graphical user interface for PSPP. - Copyright (C) 2007, 2009 Free Software Foundation + Copyright (C) 2007, 2009, 2010 Free Software Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -131,8 +131,7 @@ get_object_assert (GtkBuilder *builder, const gchar *name, GType type) if ( !o ) g_critical ("Object \"%s\" could not be found\n", name); - - if ( ! g_type_is_a (G_OBJECT_TYPE (o), type)) + else if ( ! g_type_is_a (G_OBJECT_TYPE (o), type)) { g_critical ("Object \"%s\" was expected to have type %s, but in fact has type %s", name, g_type_name (type), G_OBJECT_TYPE_NAME (o)); -- 2.30.2