From 56e2dc69b35219856db38246ba22733f0cfd4daa Mon Sep 17 00:00:00 2001 From: Gary Burton Date: Thu, 10 Apr 2008 21:35:25 +0000 Subject: [PATCH] Stop crash on media editor when no image present bug #2014 svn: r10543 --- src/Editors/_EditMedia.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Editors/_EditMedia.py b/src/Editors/_EditMedia.py index 2413aee14..72c3e4520 100644 --- a/src/Editors/_EditMedia.py +++ b/src/Editors/_EditMedia.py @@ -205,11 +205,13 @@ class EditMedia(EditPrimary): def view_media(self, obj): ref_obj = self.dbstate.db.get_object_from_handle(self.obj.handle) - mime_type = ref_obj.get_mime_type() - app = Mime.get_application(mime_type) - if app: - Utils.launch(app[0], Utils.media_path_full(self.dbstate.db, - ref_obj.get_path())) + + if ref_obj: + mime_type = ref_obj.get_mime_type() + app = Mime.get_application(mime_type) + if app: + Utils.launch(app[0], Utils.media_path_full(self.dbstate.db, + ref_obj.get_path())) def select_file(self, val): self.determine_mime()