[gitg] Do not crash when hiding region header with no next line



commit cb9feefb2876c807b2db53c080c6c5700c392b4b
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Sat May 29 13:28:44 2010 +0200

    Do not crash when hiding region header with no next line
    
    Some things are not parsed correctly in the diff view (like
    changes to binary files). This makes sure it at least doesn't
    crash in those cases.

 gitg/gitg-diff-view.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-diff-view.c b/gitg/gitg-diff-view.c
index 26f4d01..7836db6 100644
--- a/gitg/gitg-diff-view.c
+++ b/gitg/gitg-diff-view.c
@@ -368,7 +368,15 @@ hide_header_details (GitgDiffView *view,
 	gtk_text_buffer_get_iter_at_line (buffer, &startiter, line);
 
 	enditer = startiter;
-	gtk_text_iter_forward_lines (&enditer, region->next->line - line);
+
+	if (region->next)
+	{
+		gtk_text_iter_forward_lines (&enditer, region->next->line - line);
+	}
+	else
+	{
+		gtk_text_iter_forward_line (&enditer);
+	}
 
 	gtk_text_buffer_apply_tag (buffer, view->priv->subheader_tag, &startiter, &enditer);
 }



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