Skip to content

Commit 22a91c1

Browse files
authored
Merge pull request #928 from aruiz/master
gdk-pixbuf: check if either width/height is null before assignment in animation_get_size()
2 parents 3974526 + 0456e1f commit 22a91c1

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

gdk-pixbuf/src/subclass/pixbuf_animation.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,20 @@ unsafe extern "C" fn animation_get_size<T: PixbufAnimationImpl>(
137137
width_ptr: *mut libc::c_int,
138138
height_ptr: *mut libc::c_int,
139139
) {
140+
if width_ptr.is_null() && height_ptr.is_null() {
141+
return;
142+
}
143+
140144
let instance = &*(ptr as *mut T::Instance);
141145
let imp = instance.imp();
142146

143147
let (width, height) = imp.size();
144-
*width_ptr = width;
145-
*height_ptr = height;
148+
if !width_ptr.is_null() {
149+
*width_ptr = width;
150+
}
151+
if !height_ptr.is_null() {
152+
*height_ptr = height;
153+
}
146154
}
147155

148156
unsafe extern "C" fn animation_get_static_image<T: PixbufAnimationImpl>(

0 commit comments

Comments
 (0)