[gnote] NoteOfTheDayApplicationAddin: Handle exception if '\n' is absent



commit 0c39fcc53662b89545e27c26beaa96f54c4fa398
Author: Debarshi Ray <debarshir src gnome org>
Date:   Sun Jan 3 17:25:13 2010 +0200

    NoteOfTheDayApplicationAddin: Handle exception if '\n' is absent
    
    Fixes: https://bugzilla.gnome.org/605869

 src/addins/noteoftheday/noteoftheday.cpp |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/addins/noteoftheday/noteoftheday.cpp b/src/addins/noteoftheday/noteoftheday.cpp
index 322feed..c1b59d0 100644
--- a/src/addins/noteoftheday/noteoftheday.cpp
+++ b/src/addins/noteoftheday/noteoftheday.cpp
@@ -113,10 +113,14 @@ std::string NoteOfTheDay::get_content(
 std::string NoteOfTheDay::get_content_without_title(
                               const std::string & content)
 {
-  return (content.empty())
-          ? ""
-          : content.substr(content.find("\n", 0),
-                           std::string::npos);
+  std::string str = "";
+  try {
+    str = content.substr(content.find("\n", 0), std::string::npos);
+  }
+  catch (const std::exception &) {
+  }
+
+  return str;
 }
 
 gnote::Note::Ptr NoteOfTheDay::get_note_by_date(



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