Package: snowballz
Version: 0.9.5.1-2.1
Severity: normal

Recently had a problem with snowballz crashing due to a left over user config
file that had a resolution setting that was no longer available. Just deleting
the config fixes it so it might not be worth fixing (its probably an unusual
occurrence. but i thought i might as well attach a patch for posterity if
useful

TEST CASE:
* Set resolution in ~/.snowballz.ini to too high a integer
* run snowballz gives crash
Traceback (most recent call last):
  File "snowballz.py", line 595, in <module>
    vw,vh = viewport = settings.get_res()
  File "/usr/share/games/snowballz/settings.py", line 28, in get_res
    return get_res_available()[int(qm)]
IndexError: list index out of range



-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages snowballz depends on:
ii  python                    2.5.4-9        An interactive high-level object-o
ii  python-imaging            1.1.7-1+b1     Python Imaging Library
ii  python-numpy              1:1.3.0-3+b1   Numerical Python adds a fast array
ii  python-opengl             3.0.1~b2-1     Python bindings to OpenGL
ii  python-pygame             1.8.1release-2 SDL bindings for games development
ii  python-rabbyt             0.8.1-1+b1     sprite library for Python with gam
ii  ttf-tamil-fonts           1:0.5.10       Free TrueType fonts for the Tamil 

snowballz recommends no packages.

snowballz suggests no packages.

-- no debconf information
--- Begin Message ---
* settings.py: check user configs resolution is within range of available
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/snowballz/+bug/591619

Index: snowballz-0.9.5.1/settings.py
===================================================================
--- snowballz-0.9.5.1.orig/settings.py  2010-06-09 09:21:45.000000000 +0100
+++ snowballz-0.9.5.1/settings.py       2010-06-09 09:23:14.000000000 +0100
@@ -25,6 +25,11 @@
         config.set('display', 'resolution', '0')
         save_config()
         qm = 0
+   # Catch bad resolution in config problem
+    if len(get_res_available()) < qm:
+        config.set('display', 'resolution', '0')
+        save_config()
+        qm = 0
     return get_res_available()[int(qm)]
 
 def get_option(option):
@@ -79,4 +84,4 @@
     file = open(path, 'w')
     config.write(file)
 
-load_config()
\ No newline at end of file
+load_config()

--- End Message ---

Reply via email to