26, fix crash on new chars line 190

His Dad [02-10-17 - 17:34]
26, fix crash on new chars line 190
Filename
Doc/Changelog.txt
HistOffline.lua
Screenshots/DLC.jpg
history.lua
history.txt
diff --git a/Doc/Changelog.txt b/Doc/Changelog.txt
index 3304560..bbc1606 100644
--- a/Doc/Changelog.txt
+++ b/Doc/Changelog.txt
@@ -1,3 +1,6 @@
+2017-02-11 version 36
+	Fixed bug for crash satrting new character
+
 2017-02-03 version 35
 	Craglorn Trials working
 	Hist DLC added
diff --git a/HistOffline.lua b/HistOffline.lua
index 36b3daa..12a86d9 100644
--- a/HistOffline.lua
+++ b/HistOffline.lua
@@ -14,7 +14,7 @@ local Colour_Heading_Complete = "#58FA58"

 --iup.SetGlobal("UTF8MODE","YES")
 -- ========================
-version= "35"
+version= "36"
 require( "iuplua" )
 require( "iupluacontrols" )
 dofile "../../SavedVariables/History.lua"
diff --git a/Screenshots/DLC.jpg b/Screenshots/DLC.jpg
index 68cd76f..048e5bb 100644
Binary files a/Screenshots/DLC.jpg and b/Screenshots/DLC.jpg differ
diff --git a/history.lua b/history.lua
index 210a2f5..f385162 100644
--- a/history.lua
+++ b/history.lua
@@ -1,6 +1,6 @@
 hist = {
 	name = "history",
-	version = "35",
+	version = "36",
 	initialised = false,
 	SV={},
 	L={},
@@ -187,6 +187,9 @@ local function Activated()
 	end

 	if hist.world.CP_Level > 0 and hist.world.CP[hist.world.CP_Level] ~= nil then
+		if hist.me.timeplayed_last == nil then	-- is nil on new chars
+			hist.me.timeplayed_last = 0
+		end
 		hist.world.CP[hist.world.CP_Level].time = hist.world.CP[hist.world.CP_Level].time + hist.me.timeplayed - hist.me.timeplayed_last
 	end

diff --git a/history.txt b/history.txt
index 1c478a8..06bc7f2 100644
--- a/history.txt
+++ b/history.txt
@@ -1,6 +1,6 @@
 ## Title: Dad's History
 ## APIVersion: 100017 100018
-## Version: 35
+## Version: 36
 ## Author: HisDad
 ## Description: Record progress of all characters for offline viewing.
 ## SavedVariables: History_SV