[asterisk-commits] mvanbaak: trunk r171081 - /trunk/channels/chan_skinny.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jan 25 10:50:54 CST 2009


Author: mvanbaak
Date: Sun Jan 25 10:50:53 2009
New Revision: 171081

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=171081
Log:
dont segfault when a MWI event occurs on a line without a registered device

Modified:
    trunk/channels/chan_skinny.c

Modified: trunk/channels/chan_skinny.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/channels/chan_skinny.c?view=diff&rev=171081&r1=171080&r2=171081
==============================================================================
--- trunk/channels/chan_skinny.c (original)
+++ trunk/channels/chan_skinny.c Sun Jan 25 10:50:53 2009
@@ -2513,35 +2513,37 @@
 {
 	struct skinny_line *l = userdata;
 	struct skinny_device *d = l->device;
-	struct skinnysession *s = d->session;
-	struct skinny_line *l2;
-	int new_msgs = 0;
-	int dev_msgs = 0;
-
-	if (s) {
-		if (event) {
-			l->newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
-		}
-
-		if (l->newmsgs) {
-			transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
-		} else {
-			transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
-		}
-
-		/* find out wether the device lamp should be on or off */
-		AST_LIST_TRAVERSE(&d->lines, l2, list) {
-			if (l2->newmsgs) {
-				dev_msgs++;
-			}
-		}
-
-		if (dev_msgs) {
-			transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, d->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
-		} else {
-			transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_OFF);
-		}
-		ast_verb(3, "Skinny mwi_event_cb found %d new messages\n", new_msgs);
+	if (d) {
+		struct skinnysession *s = d->session;
+		struct skinny_line *l2;
+		int new_msgs = 0;
+		int dev_msgs = 0;
+
+		if (s) {
+			if (event) {
+				l->newmsgs = ast_event_get_ie_uint(event, AST_EVENT_IE_NEWMSGS);
+			}
+
+			if (l->newmsgs) {
+				transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, l->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
+			} else {
+				transmit_lamp_indication(d, STIMULUS_VOICEMAIL, l->instance, SKINNY_LAMP_OFF);
+			}
+
+			/* find out wether the device lamp should be on or off */
+			AST_LIST_TRAVERSE(&d->lines, l2, list) {
+				if (l2->newmsgs) {
+					dev_msgs++;
+				}
+			}
+
+			if (dev_msgs) {
+				transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, d->mwiblink?SKINNY_LAMP_BLINK:SKINNY_LAMP_ON);
+			} else {
+				transmit_lamp_indication(d, STIMULUS_VOICEMAIL, 0, SKINNY_LAMP_OFF);
+			}
+			ast_verb(3, "Skinny mwi_event_cb found %d new messages\n", new_msgs);
+		}
 	}
 }
 




More information about the asterisk-commits mailing list