changeset 13:bb0c8ce689d1 v1.2.15.0

fixed minor bug on startup with new settings
author yellowfive
date Thu, 10 Jul 2014 15:25:18 -0700
parents a7bc121c536d
children 67fcc0f83329
files AskMrRobot.lua AskMrRobot.toc
diffstat 2 files changed, 18 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/AskMrRobot.lua	Thu Jul 10 13:20:32 2014 -0700
+++ b/AskMrRobot.lua	Thu Jul 10 15:25:18 2014 -0700
@@ -270,22 +270,24 @@
 	elseif event == "PLAYER_ENTERING_WORLD" then
 
 		-- delete entries that are more than 10 days old to prevent the table from growing indefinitely
-		local now = time()
-		local oldDuration = 60 * 60 * 24 * 10
-		local entryTime
-		repeat
-			-- parse entry and get time
-			local parts = {}
-			for part in string.gmatch(AmrSettings.Logins[1], "([^;]+)") do
-				tinsert(parts, part)
-			end
-			entryTime = tonumber(parts[3])
+		if AmrSettings.Logins and #AmrSettings.Logins > 0 then
+			local now = time()
+			local oldDuration = 60 * 60 * 24 * 10
+			local entryTime
+			repeat
+				-- parse entry and get time
+				local parts = {}
+				for part in string.gmatch(AmrSettings.Logins[1], "([^;]+)") do
+					tinsert(parts, part)
+				end
+				entryTime = tonumber(parts[3])
 
-			-- entries are in order, remove first entry if it is old
-			if difftime(now, entryTime) > oldDuration then
-				tremove(AmrSettings.Logins, 1)
-			end
-		until #AmrSettings.Logins == 0 or difftime(now, entryTime) <= oldDuration
+				-- entries are in order, remove first entry if it is old
+				if difftime(now, entryTime) > oldDuration then
+					tremove(AmrSettings.Logins, 1)
+				end
+			until #AmrSettings.Logins == 0 or difftime(now, entryTime) <= oldDuration
+		end
 
 		-- record the time a player logs in, used to figure out which player logged which parts of their log file
 		local key = AmrRealmName .. ";" .. AmrCharacterName .. ";"
--- a/AskMrRobot.toc	Thu Jul 10 13:20:32 2014 -0700
+++ b/AskMrRobot.toc	Thu Jul 10 15:25:18 2014 -0700
@@ -1,7 +1,7 @@
 ## Interface: 50400
 ## Title: Ask Mr. Robot
 ## Author: Team Robot, Inc.
-## Version: 1.2.14.0
+## Version: 1.2.15.0
 ## Notes: Exports/Imports data to/from askmrrobot.com.
 ## URL: www.askmrrobot.com
 ## DefaultState: Enabled