mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-10 01:13:49 +00:00
Avoid crash if the theme package doesn't contain a sheet.png file
This commit is contained in:
parent
58b9dfed11
commit
56ec9f113c
@ -287,8 +287,11 @@ void SkinTheme::loadSheet()
|
||||
newSheet = she::instance()->loadRgbaSurface(sheet_filename.c_str());
|
||||
}
|
||||
catch (...) {
|
||||
throw base::Exception("Error loading %s file", sheet_filename.c_str());
|
||||
// Ignore the error, newSheet is nullptr and we will throw our own
|
||||
// exception.
|
||||
}
|
||||
if (!newSheet)
|
||||
throw base::Exception("Error loading %s file", sheet_filename.c_str());
|
||||
|
||||
// Replace the sprite sheet
|
||||
if (m_sheet) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
// SHE library
|
||||
// Copyright (C) 2016 David Capello
|
||||
// Copyright (C) 2016-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -25,9 +25,13 @@ sk_sp<SkColorSpace> SkiaSurface::m_colorSpace;
|
||||
// static
|
||||
Surface* SkiaSurface::loadSurface(const char* filename)
|
||||
{
|
||||
FILE* f = base::open_file_raw(filename, "rb");
|
||||
if (!f)
|
||||
return nullptr;
|
||||
|
||||
std::unique_ptr<SkCodec> codec(
|
||||
SkCodec::MakeFromStream(
|
||||
std::unique_ptr<SkFILEStream>(new SkFILEStream(base::open_file_raw(filename, "rb")))));
|
||||
std::unique_ptr<SkFILEStream>(new SkFILEStream(f))));
|
||||
if (!codec)
|
||||
return nullptr;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Aseprite UI Library
|
||||
// Copyright (C) 2001-2017 David Capello
|
||||
// Copyright (C) 2001-2018 David Capello
|
||||
//
|
||||
// This file is released under the terms of the MIT license.
|
||||
// Read LICENSE.txt for more information.
|
||||
@ -654,11 +654,6 @@ void set_theme(Theme* theme, const int uiscale)
|
||||
current_ui_scale = uiscale;
|
||||
|
||||
if (theme) {
|
||||
// As the regeneration may fail, first we regenerate the theme and
|
||||
// then we set is as "the current theme." E.g. In case that we'd
|
||||
// like to show some kind of error message with the UI controls,
|
||||
// we should be able to use the previous theme to do so (instead
|
||||
// of this new unsuccessfully regenerated theme).
|
||||
theme->regenerateTheme();
|
||||
|
||||
current_theme = theme;
|
||||
|
Loading…
x
Reference in New Issue
Block a user