[Rawstudio-commit] r2193 - trunk/plugins/crop

Anders Brander anders at brander.dk
Sun Feb 1 01:40:30 CET 2009


Author: abrander
Date: 2009-02-01 01:40:29 +0100 (Sun, 01 Feb 2009)
New Revision: 2193

Modified:
   trunk/plugins/crop/crop.c
Log:
Handle NULL when setting PROP_RECTANGLE in RSCrop.

Modified: trunk/plugins/crop/crop.c
===================================================================
--- trunk/plugins/crop/crop.c	2009-02-01 00:22:17 UTC (rev 2192)
+++ trunk/plugins/crop/crop.c	2009-02-01 00:40:29 UTC (rev 2193)
@@ -139,10 +139,20 @@
 	{
 		case PROP_RECTANGLE:
 			rect = g_value_get_pointer(value);
-			crop->rectangle.x1 = MAX(rect->x1, 0);
-			crop->rectangle.y1 = MAX(rect->y1, 0);
-			crop->rectangle.x2 = MIN(rect->x2, parent_width);
-			crop->rectangle.y2 = MIN(rect->y2, parent_height);
+			if (rect)
+			{
+				crop->rectangle.x1 = MAX(rect->x1, 0);
+				crop->rectangle.y1 = MAX(rect->y1, 0);
+				crop->rectangle.x2 = MIN(rect->x2, parent_width);
+				crop->rectangle.y2 = MIN(rect->y2, parent_height);
+			}
+			else
+			{
+				crop->rectangle.x1 = MAX(0, 0);
+				crop->rectangle.y1 = MAX(0, 0);
+				crop->rectangle.x2 = MIN(65535, parent_width);
+				crop->rectangle.y2 = MIN(65535, parent_height);
+			}
 			rs_filter_changed(filter);
 			break;
 		case PROP_X1:




More information about the Rawstudio-commit mailing list