--- cheese-webcam.c	2008-06-05 11:40:07.000000000 -0400
+++ cheese-webcam.c	2008-06-05 13:19:55.000000000 -0400
@@ -727,6 +727,26 @@
   return TRUE;
 }
 
+static void cheese_element_create_failed (const char *factoryname)
+{
+  GtkDialog *dialog;
+
+  gdk_threads_enter ();
+
+  dialog = gtk_message_dialog_new (NULL,
+                                   0,
+								   GTK_MESSAGE_ERROR, 
+							 	   GTK_BUTTONS_OK, 
+							 	   "The element '%s' could not be found.", 
+								   factoryname);
+
+  g_signal_connect(dialog, "response", G_CALLBACK(gtk_main_quit), NULL);
+  gtk_window_set_title(GTK_WINDOW (dialog), "Critical Error");
+  gtk_dialog_run (dialog);
+
+  gdk_threads_leave ();
+}
+
 static gboolean
 cheese_webcam_create_video_display_bin (CheeseWebcam *webcam)
 {
@@ -740,20 +760,28 @@
 
   cheese_webcam_create_webcam_source_bin (webcam);
 
-  priv->effect_filter = gst_element_factory_make ("identity", "effect");
-  priv->csp_post_effect = gst_element_factory_make ("ffmpegcolorspace", "csp_post_effect");
+  if ((priv->effect_filter = gst_element_factory_make ("identity", "effect")) == NULL)
+    cheese_element_create_failed("identity");
+  if ((priv->csp_post_effect = gst_element_factory_make ("ffmpegcolorspace", "csp_post_effect")) == NULL)
+    cheese_element_create_failed("ffmpegcolorspace");
 
-  tee = gst_element_factory_make ("tee", "tee");
+  if ((tee = gst_element_factory_make ("tee", "tee")) == NULL)
+    cheese_element_create_failed("tee");
   
-  save_queue = gst_element_factory_make ("queue", "save_queue");
+  if ((save_queue = gst_element_factory_make ("queue", "save_queue")) == NULL)
+    cheese_element_create_failed("queue");
 
-  video_display_queue = gst_element_factory_make ("queue", "video_display_queue");
+  if ((video_display_queue = gst_element_factory_make ("queue", "video_display_queue")) == NULL)
+    cheese_element_create_failed("queue");
+
+  if ((video_scale = gst_element_factory_make ("videoscale", "video_scale")) == NULL)
+    cheese_element_create_failed("videoscale");
 
-  video_scale = gst_element_factory_make ("videoscale", "video_scale");
   /* Use bilinear scaling */
   g_object_set (video_scale, "method", 1, NULL);
 
-  video_sink = gst_element_factory_make ("gconfvideosink", "video_sink");
+  if ((video_sink = gst_element_factory_make ("gconfvideosink", "video_sink")) == NULL)
+	cheese_element_create_failed("gconfvideosink");
 
 
   gst_bin_add_many (GST_BIN (priv->video_display_bin), priv->webcam_source_bin, 
@@ -790,8 +818,10 @@
 
   priv->photo_save_bin = gst_bin_new ("photo_save_bin");
 
-  csp_photo_save_bin = gst_element_factory_make ("ffmpegcolorspace", "csp_photo_save_bin");
-  priv->photo_sink = gst_element_factory_make ("fakesink", "photo_sink");
+  if ((csp_photo_save_bin = gst_element_factory_make ("ffmpegcolorspace", "csp_photo_save_bin")) == NULL)
+    cheese_element_create_failed("ffmpegcolorspace");
+  if ((priv->photo_sink = gst_element_factory_make ("fakesink", "photo_sink")) == NULL)
+    cheese_element_create_failed("fakesink");
 
   gst_bin_add_many (GST_BIN (priv->photo_save_bin), csp_photo_save_bin,
                     priv->photo_sink, NULL);
@@ -829,20 +859,29 @@
 
   priv->video_save_bin = gst_bin_new ("video_save_bin");
 
-  priv->audio_source = gst_element_factory_make ("gconfaudiosrc", "audio_source");
-  audio_queue = gst_element_factory_make ("queue", "audio_queue");
-  audio_convert = gst_element_factory_make ("audioconvert", "audio_convert");
-  audio_enc = gst_element_factory_make ("vorbisenc", "audio_enc");
-
-  video_save_csp = gst_element_factory_make ("ffmpegcolorspace", "video_save_csp");
-  video_enc = gst_element_factory_make ("theoraenc", "video_enc");
+  if ((priv->audio_source = gst_element_factory_make ("gconfaudiosrc", "audio_source")) == NULL)
+    cheese_element_create_failed("gconfaudiosrc");
+  if ((audio_queue = gst_element_factory_make ("queue", "audio_queue")) == NULL)
+    cheese_element_create_failed("queue");
+  if ((audio_convert = gst_element_factory_make ("audioconvert", "audio_convert")) == NULL)
+    cheese_element_create_failed("audioconvert");
+  if ((audio_enc = gst_element_factory_make ("vorbisenc", "audio_enc")) == NULL)
+   cheese_element_create_failed("vorbisenc"); 
+
+  if ((video_save_csp = gst_element_factory_make ("ffmpegcolorspace", "video_save_csp")) == NULL)
+    cheese_element_create_failed("ffmpegcolorspace");
+  if ((video_enc = gst_element_factory_make ("theoraenc", "video_enc")) == NULL)
+    cheese_element_create_failed("theoraenc");
   g_object_set (video_enc, "keyframe-force", 1, NULL);
-  video_save_scale = gst_element_factory_make ("videoscale", "video_save_scale");
+  if ((video_save_scale = gst_element_factory_make ("videoscale", "video_save_scale")) == NULL)
+    cheese_element_create_failed("videoscale");
   /* Use bilinear scaling */
   g_object_set (video_save_scale, "method", 1, NULL);
 
-  mux = gst_element_factory_make ("oggmux", "mux");
-  priv->video_file_sink = gst_element_factory_make ("filesink", "video_file_sink");
+  if ((mux = gst_element_factory_make ("oggmux", "mux")) == NULL)
+    cheese_element_create_failed("oggmux");
+  if ((priv->video_file_sink = gst_element_factory_make ("filesink", "video_file_sink")) == NULL)
+    cheese_element_create_failed("filesink");
 
   gst_bin_add_many (GST_BIN (priv->video_save_bin), priv->audio_source, audio_queue,
                     audio_convert, audio_enc, video_save_csp, video_save_scale, video_enc, 
