diff --git a/tools/buildimage b/tools/buildimage
index 442bb3e97f0c010a5bdc2855f1d9f6a7cbcfb5f1..2216ad82d470e3acb14f70276cda566b8b0fe8b6 100755
--- a/tools/buildimage
+++ b/tools/buildimage
@@ -107,7 +107,7 @@ sub svg_element_start
         $width = $attr{'width'};
         $height = $attr{'height'};
 
-        if(defined($x) and defined($x)) {
+        if(defined($x) and defined($y)) {
             if($x =~ /\d*/ and $y =~ /\d*/) {
                 shell $convert, $renderedSVGFileName, "-crop", "${width}x${height}+$x+$y", $pngFileName;
             }