[libgda] Tools crash corrections



commit eb671fa725e7003db4015c7fb85df95552e89650
Author: Vivien Malerba <malerba gnome-db org>
Date:   Tue Nov 18 20:22:04 2014 +0100

    Tools crash corrections

 tools/base/base-tool-command.c |    5 ++++-
 tools/tools-main.c             |    4 +++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/tools/base/base-tool-command.c b/tools/base/base-tool-command.c
index 07c6388..fcf64c3 100644
--- a/tools/base/base-tool-command.c
+++ b/tools/base/base-tool-command.c
@@ -438,7 +438,10 @@ base_tool_command_group_execute (ToolCommandGroup *group, const gchar *cmde,
        if (!cmd) {
                if (args[0] && ((*args[0] == 'h') || (*args[0] == '?'))) {
                        /* help requested */
+                       g_clear_error (error);
                        res = base_tool_help_get_command_help (group, args [1], error);
+                       if (!res)
+                               return NULL;
                }
                else {
                        g_strfreev (args);
@@ -446,7 +449,7 @@ base_tool_command_group_execute (ToolCommandGroup *group, const gchar *cmde,
                }
        }
 
-       if (!res) {
+       if (cmd && !res) {
                if (cmd->command_func)
                        res = cmd->command_func (cmd, nargs - 1, (const gchar**) args + 1, user_data, error);
                else
diff --git a/tools/tools-main.c b/tools/tools-main.c
index dd7e8ea..b5d6341 100644
--- a/tools/tools-main.c
+++ b/tools/tools-main.c
@@ -413,7 +413,9 @@ command_line (GApplication *application, GApplicationCommandLine *cmdline)
        if (getenv ("GDA_SQL_CNC")) {
                const gchar *cncname;
                cncname = getenv ("GDA_SQL_CNC");
-               g_array_append_val (array, cncname);
+               gchar *tmp;
+               tmp = g_strdup (cncname);
+               g_array_append_val (array, tmp);
        }
 
        gda_signal_connect (application, "connection-added",


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]