7434: Media viewer list crashes during start if one try to select an entry where the media isn't available

This commit is contained in:
Josip 2014-03-08 21:51:56 +01:00
parent 22ec94f84d
commit b868e3e256

View File

@ -21,6 +21,13 @@
# #
# $Id$ # $Id$
# #
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
import os
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# GNOME modules # GNOME modules
@ -173,10 +180,13 @@ class MetadataView(Gtk.TreeView):
self.sections = {} self.sections = {}
self.model.clear() self.model.clear()
if os.path.exists(full_path):
try: try:
metadata = GExiv2.Metadata(full_path) metadata = GExiv2.Metadata(full_path)
except: except:
return False return False
else:
return False
get_human = metadata.get_tag_interpreted_string get_human = metadata.get_tag_interpreted_string
@ -221,10 +231,13 @@ class MetadataView(Gtk.TreeView):
""" """
Return True if the gramplet has data, else return False. Return True if the gramplet has data, else return False.
""" """
if os.path.exists(full_path):
try: try:
metadata = GExiv2.Metadata(full_path) metadata = GExiv2.Metadata(full_path)
except: except:
return False return False
else:
return False
for tag in TAGS: for tag in TAGS:
if tag in metadata.get_exif_tags(): if tag in metadata.get_exif_tags():