From 4e10e30c2f99d552239871aa1b27a08a6c18f1a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sun, 5 Jun 2016 04:23:39 +0200 Subject: Imported Upstream version 0.23.1 --- src/direct/DirectPhotoPage.vala | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/direct/DirectPhotoPage.vala') diff --git a/src/direct/DirectPhotoPage.vala b/src/direct/DirectPhotoPage.vala index 58d82fc..3d23528 100644 --- a/src/direct/DirectPhotoPage.vala +++ b/src/direct/DirectPhotoPage.vala @@ -1,4 +1,4 @@ -/* Copyright 2009-2015 Yorba Foundation +/* Copyright 2016 Software Freedom Conservancy Inc. * * This software is licensed under the GNU Lesser General Public License * (version 2.1 or later). See the COPYING file in this distribution. @@ -242,7 +242,12 @@ public class DirectPhotoPage : EditingHostPage { DirectPhoto? photo = DirectPhoto.global.get_file_source(initial_file); - display_mirror_of(view_controller, photo); + if (photo != null) { + display_mirror_of(view_controller, photo); + } else { + AppWindow.panic(_("Unable open photo %s. Sorry.").printf(initial_file.get_path())); + } + initial_file = null; } @@ -406,7 +411,12 @@ public class DirectPhotoPage : EditingHostPage { base.update_actions(selected_count, count); } - private bool check_ok_to_close_photo(Photo photo) { + private bool check_ok_to_close_photo(Photo? photo) { + // Means we failed to load the photo for some reason. Do not block + // shutdown + if (photo == null) + return true; + if (!photo.has_alterations()) return true; -- cgit v1.2.3