hi again,

On Sat, May 14, 2005 at 01:25:46PM +0200, Michael Ablassmeier wrote:
> On Sat, May 14, 2005 at 01:16:40PM +0200, [EMAIL PROTECTED] wrote:
> > On Sat, May 14, 2005 at 10:05:20AM +0200, Michael Ablassmeier wrote:
> > > On Sat, May 14, 2005 at 09:33:53AM +0200, Pau Rul-lan Ferragut wrote:
> > > hmm.. It seems like your feed list is somehow broken.
> > 
> > So, when a link is broken (the red ones, are not they?)... yes, I have
> > a few of them.  
> 
> hm, well. I dont think feeds which raggle fails to update cause this
> kind of error (those ones are usualy marked red, however, i also have a
> few ones in my list and raggle works).
> 
> > When the feed list is empty the error told before happens too.
> 
> okey, im going to have a look at this one, i can reproduce this.

attached patch should fix raggles crash if the feed list file is empty.

bye,
    - michael
--- /usr/bin/raggle     2005-03-23 19:52:40.000000000 +0100
+++ ./raggle    2005-05-14 13:44:42.214614728 +0200
@@ -4308,17 +4308,20 @@
         # load feed list
         feeds_str = File.read($config['feed_list_path'])
 
-        # if it's a pre-0.4.0 feed list, then strip out the ruby/object
-        # nonsense and shift all lines over
-        if feeds_str =~ /^--- !ruby\/object:/
-          feeds_str = feeds_str.select { |line| 
-            line !~ /^(feeds:|--- !ruby\/object:)/ 
-          }.map { |line| line.gsub(/^  /, '') }.join
-        end
+        # check if feed list is empty
+        if feeds_str.size != 0
+          # if it's a pre-0.4.0 feed list, then strip out the ruby/object
+          # nonsense and shift all lines over
+          if feeds_str =~ /^--- !ruby\/object:/
+            feeds_str = feeds_str.select { |line| 
+              line !~ /^(feeds:|--- !ruby\/object:)/ 
+            }.map { |line| line.gsub(/^  /, '') }.join
+          end
 
-        # make sure the feed list exists, deserialize our feed list
-        $config['feeds'] ||= Raggle::Feed::List.new
-        $config['feeds'].feeds = YAML::load(feeds_str)
+          # make sure the feed list exists, deserialize our feed list
+          $config['feeds'] ||= Raggle::Feed::List.new
+          $config['feeds'].feeds = YAML::load(feeds_str)
+        end
       end
 
       # if there is no feed list, then load the default one

Reply via email to