EditNote: don't crash if referenced item does not exist
This commit is contained in:
parent
542dad0fc5
commit
761cf8f428
@ -362,43 +362,51 @@ class DeleteNoteQuery(object):
|
|||||||
|
|
||||||
for handle in person_list:
|
for handle in person_list:
|
||||||
person = self.db.get_person_from_handle(handle)
|
person = self.db.get_person_from_handle(handle)
|
||||||
person.remove_note(note_handle)
|
if person:
|
||||||
self.db.commit_person(person, trans)
|
person.remove_note(note_handle)
|
||||||
|
self.db.commit_person(person, trans)
|
||||||
|
|
||||||
for handle in family_list:
|
for handle in family_list:
|
||||||
family = self.db.get_family_from_handle(handle)
|
family = self.db.get_family_from_handle(handle)
|
||||||
family.remove_note(note_handle)
|
if family:
|
||||||
self.db.commit_family(family, trans)
|
family.remove_note(note_handle)
|
||||||
|
self.db.commit_family(family, trans)
|
||||||
|
|
||||||
for handle in event_list:
|
for handle in event_list:
|
||||||
event = self.db.get_event_from_handle(handle)
|
event = self.db.get_event_from_handle(handle)
|
||||||
event.remove_note(note_handle)
|
if event:
|
||||||
self.db.commit_event(event, trans)
|
event.remove_note(note_handle)
|
||||||
|
self.db.commit_event(event, trans)
|
||||||
|
|
||||||
for handle in place_list:
|
for handle in place_list:
|
||||||
place = self.db.get_place_from_handle(handle)
|
place = self.db.get_place_from_handle(handle)
|
||||||
place.remove_note(note_handle)
|
if place:
|
||||||
self.db.commit_place(place, trans)
|
place.remove_note(note_handle)
|
||||||
|
self.db.commit_place(place, trans)
|
||||||
|
|
||||||
for handle in source_list:
|
for handle in source_list:
|
||||||
source = self.db.get_source_from_handle(handle)
|
source = self.db.get_source_from_handle(handle)
|
||||||
source.remove_note(note_handle)
|
if source:
|
||||||
self.db.commit_source(source, trans)
|
source.remove_note(note_handle)
|
||||||
|
self.db.commit_source(source, trans)
|
||||||
|
|
||||||
for handle in citation_list:
|
for handle in citation_list:
|
||||||
citation = self.db.get_citation_from_handle(handle)
|
citation = self.db.get_citation_from_handle(handle)
|
||||||
citation.remove_note(note_handle)
|
if citation:
|
||||||
self.db.commit_citation(citation, trans)
|
citation.remove_note(note_handle)
|
||||||
|
self.db.commit_citation(citation, trans)
|
||||||
|
|
||||||
for handle in media_list:
|
for handle in media_list:
|
||||||
media = self.db.get_media_from_handle(handle)
|
media = self.db.get_media_from_handle(handle)
|
||||||
media.remove_note(note_handle)
|
if media:
|
||||||
self.db.commit_media(media, trans)
|
media.remove_note(note_handle)
|
||||||
|
self.db.commit_media(media, trans)
|
||||||
|
|
||||||
for handle in repo_list:
|
for handle in repo_list:
|
||||||
repo = self.db.get_repository_from_handle(handle)
|
repo = self.db.get_repository_from_handle(handle)
|
||||||
repo.remove_note(note_handle)
|
if repo:
|
||||||
self.db.commit_repository(repo, trans)
|
repo.remove_note(note_handle)
|
||||||
|
self.db.commit_repository(repo, trans)
|
||||||
|
|
||||||
self.db.enable_signals()
|
self.db.enable_signals()
|
||||||
self.db.remove_note(note_handle, trans)
|
self.db.remove_note(note_handle, trans)
|
||||||
|
Loading…
Reference in New Issue
Block a user