changeset 61416:89b8166ef056

(mirror_line_dance): Avoid crash if W2 is null.
author Richard M. Stallman <rms@gnu.org>
date Sat, 09 Apr 2005 23:51:18 +0000
parents aff13f8c8b75
children 93f7c57762e3
files src/dispnew.c
diffstat 1 files changed, 14 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Sat Apr 09 19:18:25 2005 +0000
+++ b/src/dispnew.c	Sat Apr 09 23:51:18 2005 +0000
@@ -3165,14 +3165,20 @@
 		  int m2_from;
 
 		  w2 = frame_row_to_window (root, frame_from);
-		  m2 = w2->current_matrix;
-		  m2_from = frame_from - m2->matrix_y;
-		  copy_row_except_pointers (m->rows + window_to,
-					    m2->rows + m2_from);
-
-		  /* If frame line is empty, window line is empty, too.  */
-		  if (!retained_p[copy_from[i]])
-		    m->rows[window_to].enabled_p = 0;
+		  /* ttn@surf.glug.org: when enabling menu bar using `emacs
+		     -nw', FROM_FRAME sometimes has no associated window.
+		     This check avoids a segfault if W2 is null.  */
+		  if (w2)
+		    {
+		      m2 = w2->current_matrix;
+		      m2_from = frame_from - m2->matrix_y;
+		      copy_row_except_pointers (m->rows + window_to,
+						m2->rows + m2_from);
+
+		      /* If frame line is empty, window line is empty, too.  */
+		      if (!retained_p[copy_from[i]])
+			m->rows[window_to].enabled_p = 0;
+		    }
 		  sync_p = 1;
 		}
 	      else if (from_inside_window_p)