mirror of
https://github.com/aseprite/aseprite.git
synced 2025-04-18 11:42:47 +00:00
Check missing theme styles to avoid crashes w/broken themes
This commit is contained in:
parent
79f4e892f1
commit
d43ff9b32b
@ -48,6 +48,10 @@ void for_each_layer(const int flags,
|
|||||||
const Style* style,
|
const Style* style,
|
||||||
std::function<void(const Style::Layer&)> callback)
|
std::function<void(const Style::Layer&)> callback)
|
||||||
{
|
{
|
||||||
|
ASSERT(style);
|
||||||
|
if (!style)
|
||||||
|
return;
|
||||||
|
|
||||||
const Style::Layer* bestLayer = nullptr;
|
const Style::Layer* bestLayer = nullptr;
|
||||||
|
|
||||||
for (const auto& layer : style->layers()) {
|
for (const auto& layer : style->layers()) {
|
||||||
@ -298,6 +302,10 @@ void Theme::paintLayer(Graphics* g,
|
|||||||
gfx::Rect& rc,
|
gfx::Rect& rc,
|
||||||
gfx::Color& bgColor)
|
gfx::Color& bgColor)
|
||||||
{
|
{
|
||||||
|
ASSERT(style);
|
||||||
|
if (!style)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (layer.type()) {
|
switch (layer.type()) {
|
||||||
|
|
||||||
case Style::Layer::Type::kBackground:
|
case Style::Layer::Type::kBackground:
|
||||||
@ -493,6 +501,10 @@ void Theme::measureLayer(const Widget* widget,
|
|||||||
gfx::Size& textHint, int& textAlign,
|
gfx::Size& textHint, int& textAlign,
|
||||||
gfx::Size& iconHint, int& iconAlign)
|
gfx::Size& iconHint, int& iconAlign)
|
||||||
{
|
{
|
||||||
|
ASSERT(style);
|
||||||
|
if (!style)
|
||||||
|
return;
|
||||||
|
|
||||||
switch (layer.type()) {
|
switch (layer.type()) {
|
||||||
|
|
||||||
case Style::Layer::Type::kBackground:
|
case Style::Layer::Type::kBackground:
|
||||||
@ -602,6 +614,8 @@ void Theme::calcWidgetMetrics(const Widget* widget,
|
|||||||
{
|
{
|
||||||
ASSERT(widget);
|
ASSERT(widget);
|
||||||
ASSERT(style);
|
ASSERT(style);
|
||||||
|
if (!style)
|
||||||
|
return;
|
||||||
|
|
||||||
borderHint = gfx::Border(0, 0, 0, 0);
|
borderHint = gfx::Border(0, 0, 0, 0);
|
||||||
gfx::Border paddingHint(0, 0, 0, 0);
|
gfx::Border paddingHint(0, 0, 0, 0);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user