bugfix: don't crash on error in normal mode capture
authorulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 16 Apr 2005 19:31:06 +0000 (19:31 +0000)
committerulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7>
Sat, 16 Apr 2005 19:31:06 +0000 (19:31 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@14104 f5534014-38df-0310-8fa8-9805f1628bb7

capture.c

index 200ddb452fc5d2e94a67e7583fc8c54848a04a6d..e6cfde0fdea4a974b2859a607cff42f7043e19d5 100644 (file)
--- a/capture.c
+++ b/capture.c
@@ -330,9 +330,16 @@ capture_input_closed(capture_options *capture_opts)
         /* first of all, we are not doing a capture any more */
         cf_callback_invoke(cf_cb_live_capture_fixed_finished, capture_opts->cf);
 
-        /* this is a normal mode capture, read in the capture file data */
-        capture_input_read_all(capture_opts, cf_is_tempfile(capture_opts->cf), 
-            cf_get_drops_known(capture_opts->cf), cf_get_drops(capture_opts->cf));
+        /* this is a normal mode capture and if no error happened, read in the capture file data */
+        if(capture_opts->save_file != NULL) {
+            capture_input_read_all(capture_opts, cf_is_tempfile(capture_opts->cf), 
+                cf_get_drops_known(capture_opts->cf), cf_get_drops(capture_opts->cf));
+        }
+    }
+
+    /* if we couldn't open a capture file, there's nothing more for us to do */
+    if(capture_opts->save_file == NULL) {
+        return;
     }
 
     /* does the user wants to restart the current capture? */