]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fixed crash when subscribing to a channel or service would fail
authorJohn Törnblom <john.tornblom@gmail.com>
Sat, 10 Mar 2012 11:14:26 +0000 (12:14 +0100)
committerJohn Törnblom <john.tornblom@gmail.com>
Sun, 11 Mar 2012 17:18:03 +0000 (18:18 +0100)
src/webui/webui.c

index 2483c2be096e3bc95a48c91705096ad48dcf50c1..71122d00a8c477b79167417af3a41310c6378add 100644 (file)
@@ -376,11 +376,12 @@ http_stream_service(http_connection_t *hc, service_t *service)
 
   pthread_mutex_unlock(&global_lock);
 
-  http_stream_run(hc, &sq, s);
-
-  pthread_mutex_lock(&global_lock);
-  subscription_unsubscribe(s);
-  pthread_mutex_unlock(&global_lock);
+  if(s) {
+    http_stream_run(hc, &sq, s);
+    pthread_mutex_lock(&global_lock);
+    subscription_unsubscribe(s);
+    pthread_mutex_unlock(&global_lock);
+  }
 
   globalheaders_destroy(gh);
   tsfix_destroy(tsfix);
@@ -411,11 +412,12 @@ http_stream_channel(http_connection_t *hc, channel_t *ch)
                                        0);
   pthread_mutex_unlock(&global_lock);
 
-  http_stream_run(hc, &sq, s);
-
-  pthread_mutex_lock(&global_lock);
-  subscription_unsubscribe(s);
-  pthread_mutex_unlock(&global_lock);
+  if(s) {
+    http_stream_run(hc, &sq, s);
+    pthread_mutex_lock(&global_lock);
+    subscription_unsubscribe(s);
+    pthread_mutex_unlock(&global_lock);
+  }
 
   globalheaders_destroy(gh);
   tsfix_destroy(tsfix);