[empathy] CameraMenu: don't crash if there are no cameras
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: commits-list gnome org
- Cc: 
- Subject: [empathy] CameraMenu: don't crash if there are no cameras
- Date: Mon, 15 Aug 2011 12:07:32 +0000 (UTC)
commit d6be6c7eb33dbd96e4c8f72369b9a9816fc23492
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Mon Aug 15 12:07:47 2011 +0100
    CameraMenu: don't crash if there are no cameras
 src/empathy-camera-menu.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-camera-menu.c b/src/empathy-camera-menu.c
index b38cc5f..6a7d20c 100644
--- a/src/empathy-camera-menu.c
+++ b/src/empathy-camera-menu.c
@@ -246,7 +246,7 @@ empathy_camera_menu_prefs_camera_changed_cb (GSettings *settings,
     EmpathyCameraMenu *self)
 {
   gchar *device = g_settings_get_string (settings, key);
-  GtkRadioAction *action;
+  GtkRadioAction *action = NULL;
   gboolean found = FALSE;
   GList *l;
 
@@ -266,10 +266,11 @@ empathy_camera_menu_prefs_camera_changed_cb (GSettings *settings,
 
   /* If the selected camera isn't found, we connect the first
    * available one */
-  if (!found)
+  if (!found && self->priv->cameras->head != NULL)
     action = self->priv->cameras->head->data;
 
-  if (!gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
+  if (action != NULL &&
+      !gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)))
     {
       g_signal_handlers_block_by_func (settings,
           empathy_camera_menu_prefs_camera_changed_cb, self);
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]