gnome-mud r664 - in trunk: . src



Author: lharris
Date: Fri Jun 20 16:19:14 2008
New Revision: 664
URL: http://svn.gnome.org/viewvc/gnome-mud?rev=664&view=rev

Log:
Les Harris: Fixed a segmetation fault that occured when history was used with no active connection.



Modified:
   trunk/ChangeLog
   trunk/src/mud-window.c

Modified: trunk/src/mud-window.c
==============================================================================
--- trunk/src/mud-window.c	(original)
+++ trunk/src/mud-window.c	Fri Jun 20 16:19:14 2008
@@ -279,29 +279,32 @@
 
 		return TRUE;
 	}
-	
-	if(event->keyval == GDK_Up)
-	{
-	    text = mud_connection_view_get_history_item(
-	        MUD_CONNECTION_VIEW(window->priv->current_view), HISTORY_UP);
+
+	if(window->priv->current_view)
+	{	
+		if(event->keyval == GDK_Up)
+		{
+		    text = mud_connection_view_get_history_item(
+		        MUD_CONNECTION_VIEW(window->priv->current_view), HISTORY_UP);
 	    
-	    gtk_text_buffer_set_text(buffer, text, strlen(text));
-	    gtk_text_buffer_get_bounds(buffer, &start, &end);
-	    gtk_text_buffer_select_range(buffer, &start, &end);
+	   		gtk_text_buffer_set_text(buffer, text, strlen(text));
+	   	 	gtk_text_buffer_get_bounds(buffer, &start, &end);
+	   	 	gtk_text_buffer_select_range(buffer, &start, &end);
 	    
-	    return TRUE;
-	}
+	    	return TRUE;
+		}
 	
-	if(event->keyval == GDK_Down)
-	{
-	    text = mud_connection_view_get_history_item(
-	        MUD_CONNECTION_VIEW(window->priv->current_view), HISTORY_DOWN);
+		if(event->keyval == GDK_Down)
+		{
+		    text = mud_connection_view_get_history_item(
+		        MUD_CONNECTION_VIEW(window->priv->current_view), HISTORY_DOWN);
 	    
-	    gtk_text_buffer_set_text(buffer, text, strlen(text));
-	    gtk_text_buffer_get_bounds(buffer, &start, &end);
-	    gtk_text_buffer_select_range(buffer, &start, &end);
+		    gtk_text_buffer_set_text(buffer, text, strlen(text));
+		    gtk_text_buffer_get_bounds(buffer, &start, &end);
+		    gtk_text_buffer_select_range(buffer, &start, &end);
 	    
-	    return TRUE;
+		    return TRUE;
+		}
 	}
 
 	return FALSE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]