]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/messagemapper.rb
utils: don't hang when getting first par with nonexistant uri-fragment
[user/henk/code/ruby/rbot.git] / lib / rbot / messagemapper.rb
index 8b52baa4a04392ee4c5d8ab78070b644e46ee39f..87bdd01f6e7150b2630848ce98cc6bca0eec111a 100644 (file)
@@ -193,7 +193,14 @@ class Bot
           if m.bot.auth.allow?(auth, m.source, m.replyto)
             debug "template match found and auth'd: #{action.inspect} #{options.inspect}"
             if tmpl.options[:thread] || tmpl.options[:threaded]
-              Thread.new { @parent.send(action, m, options) }
+              Thread.new do
+                begin
+                  @parent.send(action, m, options)
+                rescue Exception => e
+                  error "In threaded action: #{e.message}"
+                  debug e.backtrace.join("\n")
+                end
+              end
             else
               @parent.send(action, m, options)
             end
@@ -413,6 +420,7 @@ class Bot
           end
           pre = nil if extra.sub!(/^!/, "")
           post = nil if extra.sub!(/!$/, "")
+          extra = nil if extra.empty?
         else
           extra = nil
         end