Fixed error on /rt stop outside of a trial

René Welbers [01-18-16 - 15:09]
Fixed error on /rt stop outside of a trial
Filename
RaidTimer.lua
RaidTimer.txt
diff --git a/RaidTimer.lua b/RaidTimer.lua
index 988bd6d..66786e8 100644
--- a/RaidTimer.lua
+++ b/RaidTimer.lua
@@ -5,7 +5,7 @@ RaidTimer = {}

 RaidTimer.name		= 'RaidTimer'
 RaidTimer.slash		= '/rt'
-RaidTimer.version	= '1.3.1'
+RaidTimer.version	= '1.3.3'
 RaidTimer.versionDB	= 1
 RaidTimer.loaded	= false
 RaidTimer.author    = 'Noshiz, Garkin & silentgecko'
@@ -420,13 +420,15 @@ function RaidTimer.TimerStop(event, trialName, totalScore, totalTime)
         template = GetString(RAIDTIMER_TRIAL_FAILED)
     end

-    -- set savedVariables.topScores
-    local currentTopScore = self.savedVariables.topScores[raidId].score or 0
-    local currentTopTime  = self.savedVariables.topScores[raidId].time or 0
-    if totalScore > currentTopScore then
-        self.savedVariables.topScores[raidId].time  = totalTime
-        self.savedVariables.topScores[raidId].score = totalScore
-        d(zo_strformat(GetString(RAIDTIMER_NEW_TOPSCORE)))
+    if raidId > 0 then
+        -- set savedVariables.topScores
+        local currentTopScore = self.savedVariables.topScores[raidId].score or 0
+        local currentTopTime  = self.savedVariables.topScores[raidId].time or 0
+        if totalScore > currentTopScore then
+            self.savedVariables.topScores[raidId].time  = totalTime
+            self.savedVariables.topScores[raidId].score = totalScore
+            d(zo_strformat(GetString(RAIDTIMER_NEW_TOPSCORE)))
+        end
     end

     local formatedTime = ZO_FormatTimeMilliseconds(totalTime, TIME_FORMAT_STYLE_COLONS, TIME_FORMAT_PRECISION_SECONDS)
diff --git a/RaidTimer.txt b/RaidTimer.txt
index 9f009a2..8893cda 100644
--- a/RaidTimer.txt
+++ b/RaidTimer.txt
@@ -1,6 +1,6 @@
 ## Title: |cEFEBBERaid Timer|r
 ## Author: Noshiz, |cEFEBBEGarkin|r, |c4779cesilentgecko|r
-## Version: 1.3.2
+## Version: 1.3.3
 ## APIVersion: 100013
 ## SavedVariables: RTVars
 ## OptionalDependsOn: LibAddonMenu-2.0