summaryrefslogtreecommitdiffstats
path: root/debian/lenny/dependencies/libr/debian/patches/002-fix-crash-on-malformed-icon.diff
blob: 757075f0ed06e66f792ba186d9c9587799357bb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff -ru libr-0.6.0~maverick/src/libr-icons.c libr-0.6.0/src/libr-icons.c
--- libr-0.6.0~maverick/src/libr-icons.c	2011-03-02 22:22:33.000000000 +0000
+++ libr-0.6.0/src/libr-icons.c	2012-09-12 20:08:35.000000000 +0000
@@ -330,18 +330,20 @@
 			if(entry->type == LIBR_SVG)
 			{
 				libr_icon *icon = libr_icon_geticon_byname(handle, entry->name);
-				libr_icon *icon_onecanvas;
-				char *buffer;
+				if (icon) {
+					libr_icon *icon_onecanvas;
+					char *buffer;
 				
-				/* should we report the requested size for SVG? */
-				icon->icon_size = iconsize;
+					/* should we report the requested size for SVG? */
+					icon->icon_size = iconsize;
 				
-				/* if the SVG is a "one canvas" document then extract the correctly sized icon */
-				if((buffer = onecanvas_geticon_bysize(icon->buffer, iconsize)) != NULL)
-				{
-					libr_icon_close(icon);
-					icon_onecanvas = new_icon_handle(LIBR_SVG, iconsize, buffer, strlen(buffer));
-					return icon_onecanvas;
+					/* if the SVG is a "one canvas" document then extract the correctly sized icon */
+					if((buffer = onecanvas_geticon_bysize(icon->buffer, iconsize)) != NULL)
+					{
+						libr_icon_close(icon);
+						icon_onecanvas = new_icon_handle(LIBR_SVG, iconsize, buffer, strlen(buffer));
+						return icon_onecanvas;
+					}
 				}
 				return icon;
 			}