[mythtv] [PATCH] randtheme SIGFPE

Jim Radford radford+myth at blackbean.org
Thu Jan 22 16:00:22 EST 2004


When I accidentally deleted my addon themes I got a segfault when
RandTheme tried to find a different one from the one I had just used
(since there wasn't one).  This patch effectively allows the previous
theme if it's the only one found.

-Jim

Index: programs/mythfrontend/main.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/main.cpp,v
retrieving revision 1.132
diff -u -r1.132 main.cpp
--- programs/mythfrontend/main.cpp	20 Jan 2004 09:21:09 -0000	1.132
+++ programs/mythfrontend/main.cpp	22 Jan 2004 20:54:33 -0000
@@ -566,7 +566,8 @@
             themelist.append(theme->fileName());
     }
 
-    themename = themelist[rand() % themelist.size()];
+    if (themelist.size()) // ...unless it is the only one
+        themename = themelist[rand() % themelist.size()];
 
     ThemeSelector Theme;
     Theme.setValue(themename);


More information about the mythtv-dev mailing list