Index: neon-logo.scm
===================================================================
--- neon-logo.scm	(revision 22218)
+++ neon-logo.scm	(working copy)
@@ -90,10 +90,39 @@
                           (car (gimp-layer-new img width height RGBA-IMAGE "Shadow" 100 NORMAL-MODE))
                           0))
         (selection 0)
+	(max_shrink 0)
         )
 
     (gimp-context-push)
 
+    ; ensure that we don't shrink selection so much
+    ; that we create an empty selection.
+    (gimp-selection-layer-alpha tube-layer)
+    (while (= (car (gimp-selection-is-empty img)) FALSE)
+	(begin
+	  (gimp-selection-shrink img 1)
+          (set! max_shrink (+ max_shrink 1))
+          ; escape early if we know that we can perform
+	  ; as much shrink steps as we want
+	  (if (> max_shrink shrink)
+	      (gimp-selection-none img))
+	)
+    )
+    (if (= (car (gimp-selection-is-empty img)) TRUE)
+	(if (> max_shrink 0)
+	    (set! max_shrink (- max_shrink 1))))
+    ; clamp upper bounds to valid shrink step range
+    (if (> shrink max_shrink)
+	(set! shrink max_shrink))
+    (if (> inc-shrink (/ max_shrink 3))
+	(set! inc-shrink (/ max_shrink 3)))
+    (if (> shadow-shrink max_shrink)
+	(set! shadow-shrink max_shrink))
+
+    (gimp-context-pop)
+
+    (gimp-context-push)
+
     (script-fu-util-image-resize-from-layer img tube-layer)
     (gimp-image-add-layer img bg-layer 1)
     (if (not (= shadow 0))
