Author: sveinung Date: Wed Nov 2 15:24:32 2016 New Revision: 34329 URL: http://svn.gna.org/viewcvs/freeciv?rev=34329&view=rev Log: crop_sprite(): assert that source sprite exists.
Assert the existence of the source sprite in the crop_sprite() implementation of the Qt client and of the GTK clients. See patch #7900 Modified: trunk/client/gui-gtk-2.0/sprite.c trunk/client/gui-gtk-3.0/sprite.c trunk/client/gui-gtk-3.22/sprite.c trunk/client/gui-qt/sprite.cpp Modified: trunk/client/gui-gtk-2.0/sprite.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/sprite.c?rev=34329&r1=34328&r2=34329&view=diff ============================================================================== --- trunk/client/gui-gtk-2.0/sprite.c (original) +++ trunk/client/gui-gtk-2.0/sprite.c Wed Nov 2 15:24:32 2016 @@ -51,6 +51,8 @@ int mask_offset_x, int mask_offset_y) { GdkPixbuf *mypixbuf, *sub, *mask_pixbuf; + + fc_assert_ret_val(source, NULL); /* First just crop the image. */ if (x < 0) { Modified: trunk/client/gui-gtk-3.0/sprite.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/sprite.c?rev=34329&r1=34328&r2=34329&view=diff ============================================================================== --- trunk/client/gui-gtk-3.0/sprite.c (original) +++ trunk/client/gui-gtk-3.0/sprite.c Wed Nov 2 15:24:32 2016 @@ -52,6 +52,8 @@ { struct sprite *new = fc_malloc(sizeof(*new)); cairo_t *cr; + + fc_assert_ret_val(source, NULL); new->surface = cairo_surface_create_similar(source->surface, CAIRO_CONTENT_COLOR_ALPHA, width, height); Modified: trunk/client/gui-gtk-3.22/sprite.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/sprite.c?rev=34329&r1=34328&r2=34329&view=diff ============================================================================== --- trunk/client/gui-gtk-3.22/sprite.c (original) +++ trunk/client/gui-gtk-3.22/sprite.c Wed Nov 2 15:24:32 2016 @@ -52,6 +52,8 @@ { struct sprite *new = fc_malloc(sizeof(*new)); cairo_t *cr; + + fc_assert_ret_val(source, NULL); new->surface = cairo_surface_create_similar(source->surface, CAIRO_CONTENT_COLOR_ALPHA, width, height); Modified: trunk/client/gui-qt/sprite.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/sprite.cpp?rev=34329&r1=34328&r2=34329&view=diff ============================================================================== --- trunk/client/gui-qt/sprite.cpp (original) +++ trunk/client/gui-qt/sprite.cpp Wed Nov 2 15:24:32 2016 @@ -86,6 +86,8 @@ QPainter p; sprite *cropped; + fc_assert_ret_val(source, NULL); + if (!width || !height) { return NULL; } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits