diff Core.lua @ 139:debff5ad3de4

Possible issue with the overriding of the CheckInbox function where the first call to it after a login might not work might have been fixed. (I can?t reproduce it, but can see the potential for problems)
author Zerotorescue
date Sat, 29 Jan 2011 22:24:19 +0100
parents 9998d4ff8152
children 2af0f77dbae0
line wrap: on
line diff
--- a/Core.lua	Mon Dec 20 14:22:04 2010 +0100
+++ b/Core.lua	Sat Jan 29 22:24:19 2011 +0100
@@ -335,6 +335,10 @@
 	
 	self.btnConfig:Show();
 	
+	-- Reset variables
+	lastAmount = 0;
+	self.debugChannel = nil;
+	
 	if not originalCheckInbox then
 		-- Override the CheckInbox function
 		-- Remember the original
@@ -343,10 +347,6 @@
 		CheckInbox = NewCheckInbox;
 	end
 	
-	-- Reset variables
-	lastAmount = 0;
-	self.debugChannel = nil;
-	
 	-- If we were toggling this addon on while the mailbox is opened we must register all events again
 	if MailFrame:IsVisible() then
 		self:MAIL_SHOW();
@@ -818,7 +818,7 @@
 -- This should speed things up a tiny bit, but might become buggy if coded wrong
 -- We actually override the function in the onenable
 function NewCheckInbox(...)
-	if not MailOpener.db.profile.general.overrideCheckInbox or not MailOpener.db.profile.general.continueOpening or lastAmount == 0 then
+	if not MailOpener.db.profile.general.overrideCheckInbox or not MailOpener.db.profile.general.continueOpening or not lastAmount or lastAmount == 0 then
 		-- If the override Check Inbox option is off
 		-- or continuous opening is off
 		-- or there's currently no mail visible
@@ -841,4 +841,4 @@
 		
 		return originalCheckInbox(...);
 	end
-end
\ No newline at end of file
+end