# HG changeset patch
# User Matthew Wild <mwild1@gmail.com>
# Date 1336939620 -3600
# Node ID 4e9781a612423abae286a0e7b5c97d9d292c0b42
# Parent  19e69cea614613cd6e7e385490d50d68c18a8703
muc.lib: Fix for traceback when no history length is set for the room

diff -r 19e69cea6146 -r 4e9781a61242 plugins/muc/muc.lib.lua
--- a/plugins/muc/muc.lib.lua	Sun May 13 16:03:05 2012 +0100
+++ b/plugins/muc/muc.lib.lua	Sun May 13 21:07:00 2012 +0100
@@ -135,7 +135,7 @@
 		stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
 		local entry = { stanza = stanza, stamp = stamp };
 		t_insert(history, entry);
-		while #history > self._data.history_length do t_remove(history, 1) end
+		while #history > (self._data.history_length or default_history_length) do t_remove(history, 1) end
 	end
 end
 function room_mt:broadcast_except_nick(stanza, nick)