changeset 14815:49450a1bc58e

[gaim-migrate @ 17581] Check to make sure UI ops exist for network_connected and network_disconnected before calling them. Thanks to plaes on #gaim who says this fixes some gaim-text crashes. committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Wed, 25 Oct 2006 12:51:22 +0000
parents eb1684a9a029
children c538d7df38d6
files libgaim/network.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/network.c	Wed Oct 25 12:14:23 2006 +0000
+++ b/libgaim/network.c	Wed Oct 25 12:51:22 2006 +0000
@@ -436,9 +436,10 @@
 
 	gaim_debug_info("network", "Received Network Change Notification. Current network count is %d, previous count was %d.\n", new_count, current_network_count);
 
-	if (new_count > 0) {
+	if (new_count > 0 && ui_ops != NULL && ui_ops->network_connected != NULL) {
 		ui_ops->network_connected();
-	} else if (new_count == 0 && current_network_count > 0) {
+	} else if (new_count == 0 && current_network_count > 0 &&
+			   ui_ops != NULL && ui_ops->network_disconnected != NULL) {
 		ui_ops->network_disconnected();
 	}
 
@@ -548,13 +549,15 @@
 	case LIBNM_ACTIVE_NETWORK_CONNECTION:
 		/* Call res_init in case DNS servers have changed */
 		res_init();
-		ui_ops->network_connected();
+		if (ui_ops != NULL && ui_ops->network_connected != NULL)
+			ui_ops->network_connected();
 		prev = current;
 		break;
 	case LIBNM_NO_NETWORK_CONNECTION:
 		if (prev != LIBNM_ACTIVE_NETWORK_CONNECTION)
 			break;
-		ui_ops->network_disconnected();
+		if (ui_ops != NULL && ui_ops->network_disconnected != NULL)
+			ui_ops->network_disconnected();
 		prev = current;
 		break;
 	case LIBNM_NO_DBUS: