summaryrefslogtreecommitdiffstats
path: root/src/ege-select-one-action.cpp
diff options
context:
space:
mode:
authorKris De Gussem <kris.degussem@gmail.com>2012-02-22 18:49:11 +0000
committerKris <Kris.De.Gussem@hotmail.com>2012-02-22 18:49:11 +0000
commit0e4dbbbc3f531a1d5d7ac6396325bfe2185d04a2 (patch)
tree0958a8693dc62745ce0fec19aa170e9acd8e776f /src/ege-select-one-action.cpp
parentFix for 938349 : Compile error in spellcheck.h when aspell is unavailable (diff)
downloadinkscape-0e4dbbbc3f531a1d5d7ac6396325bfe2185d04a2.tar.gz
inkscape-0e4dbbbc3f531a1d5d7ac6396325bfe2185d04a2.zip
cppcheck: null pointer dereference fix
(bzr r11009)
Diffstat (limited to 'src/ege-select-one-action.cpp')
-rw-r--r--src/ege-select-one-action.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/ege-select-one-action.cpp b/src/ege-select-one-action.cpp
index a546bc6f7..f2c97cdc4 100644
--- a/src/ege-select-one-action.cpp
+++ b/src/ege-select-one-action.cpp
@@ -1158,17 +1158,15 @@ int scan_max_width( GtkTreeModel *model, gint labelColumn )
GtkTreeIter iter;
gboolean valid = gtk_tree_model_get_iter_first( model, &iter );
while ( valid ) {
- gchar* str = 0;
- int count = 0;
- gtk_tree_model_get( model, &iter,
- labelColumn, &str,
- -1 );
- count = strlen(str);
- if (count > maxUsed) {
- maxUsed = count;
+ gchar* str = NULL;
+ gtk_tree_model_get( model, &iter, labelColumn, &str, -1 );
+ if (str != NULL){
+ int count = strlen(str);
+ if (count > maxUsed) {
+ maxUsed = count;
+ }
+ g_free(str);
}
- g_free( str );
-
valid = gtk_tree_model_iter_next( model, &iter );
}
return maxUsed;