Skip to content

Commit f53ddd0

Browse files
committed
Fix warnings
1 parent 4ce9544 commit f53ddd0

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/ShadowEffect.vala

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ public class Gala.ShadowEffect : Clutter.Effect {
103103
}
104104

105105
var texture = get_shadow_texture (context, width, height, shadow_size, border_radius);
106-
shadow_cache.@set (current_key, new Shadow (texture));
106+
if (texture != null) {
107+
shadow_cache.@set (current_key, new Shadow (texture));
108+
}
107109

108110
return texture;
109111
}
@@ -190,7 +192,7 @@ public class Gala.ShadowEffect : Clutter.Effect {
190192
});
191193
}
192194

193-
private Cogl.Texture get_shadow_texture (Cogl.Context context, int width, int height, int shadow_size, int corner_radius) {
195+
private Cogl.Texture? get_shadow_texture (Cogl.Context context, int width, int height, int shadow_size, int corner_radius) {
194196
var data = new uint8[width * height];
195197

196198
// use fast Gaussian blur approximation
@@ -269,6 +271,11 @@ public class Gala.ShadowEffect : Clutter.Effect {
269271
}
270272
}
271273

272-
return new Cogl.Texture2D.from_data (context, width, height, Cogl.PixelFormat.A_8, width, data);
274+
try {
275+
return new Cogl.Texture2D.from_data (context, width, height, Cogl.PixelFormat.A_8, width, data);
276+
} catch (Error e) {
277+
warning ("ShadowEffect: Couldn't create texture");
278+
return null;
279+
}
273280
}
274281
}

0 commit comments

Comments
 (0)