Blob Blame History Raw
--- xscreensaver-5.11/hacks/xjack.c.debug	2008-07-31 18:52:05.000000000 +0900
+++ xscreensaver-5.11/hacks/xjack.c	2010-06-14 17:54:10.000000000 +0900
@@ -117,8 +117,25 @@
   xjack_reshape (dpy, window, st, st->xgwa.width, st->xgwa.height);
 
   st->left = 0xFF & (random() % ((st->columns / 2)+1));
-  st->right = st->left + (0xFF & (random() % (st->columns - st->left - 10)
-                                  + 10));
+
+  /* deal with small window */
+  {
+    int tmp;
+    if (st->columns <= 11)
+    {
+      fprintf(stderr, "Column width %i is too short for %s, exiting...\n",
+          st->columns, progname);
+      exit(1);
+     }
+    tmp = st->columns - st->left - 10;
+    if (tmp < 1)
+    {
+      tmp = 1;
+      st->left = st->columns - 10 - tmp;
+    }
+    st->right = st->left + (0xFF & (random() % tmp + 10));
+  }
+
   st->x = 0;
   st->y = 0;