[dia] [scan-build] Dereference of null pointer (maybe)
- From: Hans Breuer <hans src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia] [scan-build] Dereference of null pointer (maybe)
- Date: Mon, 9 Jun 2014 08:48:31 +0000 (UTC)
commit 53867f51d2331cd2c2cd25f358473e76f55439e8
Author: Hans Breuer <hans breuer org>
Date: Mon Jun 9 10:16:11 2014 +0200
[scan-build] Dereference of null pointer (maybe)
Remove two of three 'logic error' reported by scan-build by
g_return_if_fail(). Most of the ddisp taking functions are
expecting a valid ddisp, not NULL.
The remaining issue should not hapen in real world scenario
and is caused by one of the functions where ddisp=NULL is
allowed. With display_set_active(NULL) the function in
question would crash before the reported case, though.
app/display.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/app/display.c b/app/display.c
index 5f53534..053e804 100644
--- a/app/display.c
+++ b/app/display.c
@@ -142,7 +142,7 @@ initialize_display_widgets(DDisplay *ddisp)
Diagram *dia = ddisp->diagram;
gchar *filename;
- /* ddisp->renderer = new_gdk_renderer(ddisp);*/
+ g_return_if_fail (dia && dia->filename);
ddisp->im_context = gtk_im_multicontext_new();
g_signal_connect (G_OBJECT (ddisp->im_context), "commit",
@@ -1025,6 +1025,7 @@ ddisplay_scroll_center_point(DDisplay *ddisp, Point *p)
{
Point center;
+ g_return_val_if_fail (ddisp != NULL, FALSE);
/* Find current center */
center.x = (ddisp->visible.right+ddisp->visible.left)/2;
center.y = (ddisp->visible.top+ddisp->visible.bottom)/2;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]