[gnote] Fix crash in delete_notebook when notebook has no tag
- From: Aurimas Černius <aurimasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnote] Fix crash in delete_notebook when notebook has no tag
- Date: Sun, 4 Aug 2013 19:54:02 +0000 (UTC)
commit 6d37bbb274536dd8cab62d943c6dc4a92cc7b8b4
Author: Aurimas Černius <aurisc4 gmail com>
Date: Sun Aug 4 22:47:03 2013 +0300
Fix crash in delete_notebook when notebook has no tag
src/notebooks/notebookmanager.cpp | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/notebooks/notebookmanager.cpp b/src/notebooks/notebookmanager.cpp
index afc7d5a..9c8d042 100644
--- a/src/notebooks/notebookmanager.cpp
+++ b/src/notebooks/notebookmanager.cpp
@@ -189,10 +189,11 @@ namespace gnote {
// Remove the notebook tag from every note that's in the notebook
std::list<Note *> notes;
- notebook->get_tag()->get_notes(notes);
- for(std::list<Note *>::const_iterator note_iter = notes.begin();
- note_iter != notes.end(); ++note_iter) {
- Note * note = *note_iter;
+ Tag::Ptr tag = notebook->get_tag();
+ if(tag) {
+ tag->get_notes(notes);
+ }
+ FOREACH(Note *note, notes) {
note->remove_tag (notebook->get_tag());
m_note_removed_from_notebook (*note, notebook);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]