Fixed transport detachment when there's no thread being used in siprtp.



git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@800 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjsip-apps/src/samples/siprtp.c b/pjsip-apps/src/samples/siprtp.c
index 49494b8..4fc236e 100644
--- a/pjsip-apps/src/samples/siprtp.c
+++ b/pjsip-apps/src/samples/siprtp.c
@@ -1442,17 +1442,21 @@
 {
     struct media_stream *audio = &app.call[call_index].media[0];
 
-    if (audio->thread) {
-
+    if (audio) {
 	audio->active = PJ_FALSE;
 
-	audio->thread_quit_flag = 1;
-	pj_thread_join(audio->thread);
-	pj_thread_destroy(audio->thread);
-	audio->thread = NULL;
-	audio->thread_quit_flag = 0;
+	if (audio->thread) {
+	    audio->thread_quit_flag = 1;
+	    pj_thread_join(audio->thread);
+	    pj_thread_destroy(audio->thread);
+	    audio->thread = NULL;
+	    audio->thread_quit_flag = 0;
+	}
 
-	pjmedia_transport_detach(audio->transport, audio);
+	if (audio->transport) {
+	    pjmedia_transport_detach(audio->transport, audio);
+	    audio->transport = NULL;
+	}
     }
 }