From 80a464021662614f92f1e70a0dd6fc228c218fff Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 13 Oct 2008 10:07:47 -0400 Subject: [PATCH] Saved breakpoints (or any breakpoint) that had a file that does not exist would crash MacGDBp * Source/BSSourceView.m: (setFile:): If the file does not exist, simply display an empty string (scrollToLine:): If the file does not exist, return --- CHANGES | 6 ++++++ Source/BSSourceView.m | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/CHANGES b/CHANGES index 7f1b24d..a102fef 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,12 @@ MacGDBp CHANGE LOG ================================================================================ +1.1.2 +##################### +- Fix: #140 Saved breakpoints for non-existent files would cause an immediate +crash on launch + + 1.1.1 ##################### - Fix: Breakpoints that were removed would come back, multiplied upon relaunch diff --git a/Source/BSSourceView.m b/Source/BSSourceView.m index 43cd3f4..e2290f7 100644 --- a/Source/BSSourceView.m +++ b/Source/BSSourceView.m @@ -65,6 +65,12 @@ [file release]; file = [f retain]; } + + if (![[NSFileManager defaultManager] fileExistsAtPath:f]) + { + [textView setString:@""]; + return; + } @try { @@ -116,6 +122,9 @@ */ - (void)scrollToLine:(int)line { + if (![[NSFileManager defaultManager] fileExistsAtPath:file]) + return; + // go through the document until we find the NSRange for the line we want int rangeIndex = 0; for (int i = 0; i < line; i++) -- 2.22.5