[ekiga] Fixed a crash with a std::string(NULL)



commit 13e837806d95cc9aa967851f484b22bf8f46706f
Author: Julien Puydt <jpuydt gnome org>
Date:   Sun Aug 30 14:05:15 2009 +0200

    Fixed a crash with a std::string(NULL)
    
    This was bug #593528, and I fixed it by making a public
    function private and going pure C++ as soon as possible.

 src/gui/main.cpp |   14 ++++++++++++--
 src/gui/main.h   |    7 -------
 2 files changed, 12 insertions(+), 9 deletions(-)
---
diff --git a/src/gui/main.cpp b/src/gui/main.cpp
index f1b7892..f156b35 100644
--- a/src/gui/main.cpp
+++ b/src/gui/main.cpp
@@ -506,6 +506,11 @@ static void ekiga_main_window_add_device_dialog_show (EkigaMainWindow *main_wind
                                                       DeviceType device_type);
 
 
+/* DESCRIPTION   :  /
+ * BEHAVIOR      : Returns the currently called URL in the URL bar.
+ * PRE           : The main window GMObject.
+ */
+static const std::string ekiga_main_window_get_call_url (EkigaMainWindow *mw);
 
 /* 
  * Engine Callbacks 
@@ -4199,12 +4204,17 @@ ekiga_main_window_append_call_url (EkigaMainWindow *mw,
 }
 
 
-const char *
+static const std::string
 ekiga_main_window_get_call_url (EkigaMainWindow *mw)
 {
   g_return_val_if_fail (EKIGA_IS_MAIN_WINDOW (mw), NULL);
 
-  return gtk_entry_get_text (GTK_ENTRY (mw->priv->entry));
+  const gchar* entry_text = gtk_entry_get_text (GTK_ENTRY (mw->priv->entry));
+
+  if (entry_text != NULL)
+    return entry_text;
+  else
+    return "";
 }
 
 
diff --git a/src/gui/main.h b/src/gui/main.h
index ebe9644..e5f4e0c 100644
--- a/src/gui/main.h
+++ b/src/gui/main.h
@@ -331,13 +331,6 @@ void ekiga_main_window_append_call_url (EkigaMainWindow *mw,
 
 
 /* DESCRIPTION   :  /
- * BEHAVIOR      : Returns the currently called URL in the URL bar.
- * PRE           : The main window GMObject.
- */
-const char *ekiga_main_window_get_call_url (EkigaMainWindow *main_window);
-
-
-/* DESCRIPTION   :  /
  * BEHAVIOR      : Clears the stats area in the control panel. 
  * PRE           : The main window GMObject.
  */



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