[nemiver] Be more tolerant with buffers with wrong content
- From: Dodji Seketeli <dodji src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver] Be more tolerant with buffers with wrong content
- Date: Wed, 8 Sep 2010 15:12:26 +0000 (UTC)
commit d219c9599dbcb81d13d67fcfa0df33b4b92384a9
Author: Dodji Seketeli <dodji redhat com>
Date: Wed Sep 8 17:08:19 2010 +0200
Be more tolerant with buffers with wrong content
* src/uicommon/nmv-source-editor.cc (move_where_marker_to_line)
(set_visual_breakpoint_at_line): Do not throw when the buffer
doesn't contain the requested line. Just return false.
src/uicommon/nmv-source-editor.cc | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/src/uicommon/nmv-source-editor.cc b/src/uicommon/nmv-source-editor.cc
index d3bd89e..60c6e95 100644
--- a/src/uicommon/nmv-source-editor.cc
+++ b/src/uicommon/nmv-source-editor.cc
@@ -834,7 +834,10 @@ SourceEditor::move_where_marker_to_line (int a_line, bool a_do_scroll)
Gtk::TextIter line_iter =
source_view ().get_source_buffer ()->get_iter_at_line (a_line - 1);
- THROW_IF_FAIL (line_iter);
+ if (!line_iter) {
+ LOG_DD ("Couldn't find line " << a_line << " in the buffer");
+ return false;
+ }
Glib::RefPtr<Gtk::TextMark> where_marker =
source_view ().get_source_buffer ()->get_mark (WHERE_MARK);
@@ -906,7 +909,11 @@ SourceEditor::set_visual_breakpoint_at_line (int a_line, bool enabled)
// marker doesn't yet exist, so create one of the correct type
Gtk::TextIter iter = buf->get_iter_at_line (a_line);
LOG_DD ("a_line: " << a_line);
- THROW_IF_FAIL (iter);
+ if (!iter) {
+ LOG_DD ("Line not found in buffer");
+ return false;
+ }
+
UString marker_name = UString::from_int (a_line);
LOG_DD ("creating marker of type: " << marker_type);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]