Beta3 fixed incorrect initialisation causing a crash.

His Dad [04-26-15 - 23:17]
Beta3 fixed incorrect initialisation causing a crash.
Filename
Doc/Changelog.txt
Doc/Description.txt
history.lua
history.txt
diff --git a/Doc/Changelog.txt b/Doc/Changelog.txt
index 600e3e0..ed874a5 100644
--- a/Doc/Changelog.txt
+++ b/Doc/Changelog.txt
@@ -1,3 +1,33 @@
+2015-04-27
+	Version 3
+	Oops! incorrect initialise on new char causes crash.
+	Log in with each char to let the updated addon fix the data file.
+	Histoffline  won't wont until all have been fixed
+
+	Cause: There is a section in the saved variable for each char that looks like this
+
+                        ["levels"] =
+                        {
+                            [61] =
+                            {
+                                ["time"] = 11996,
+                                ["Ach_Points"] = 3400,
+                                ["deaths"] = 0,
+                                ["begin"] = 1430061182,
+
+	there must not be a key  ["map"] = {
+					},
+
+	map can be a string for valid map name, but in new imported chars is should NOT be there at all.
+
+
+
+
+
+2015-04-26
+	Version 2
+	Beta Code, fixed packaging problem.
+
 2015-04-26
 	Version 1
-	Beta Code, no known bugs.
+	Beta Code, no known bugs.
\ No newline at end of file
diff --git a/Doc/Description.txt b/Doc/Description.txt
index d5476a8..ee8f9ff 100644
--- a/Doc/Description.txt
+++ b/Doc/Description.txt
@@ -75,12 +75,14 @@ I will assume you are using the folder path  C:\IUP\Lua52
 Log in to the game with a character and log out. That will ensure the savedvariable file exists.

 [SIZE=3]First, some testing[/SIZE]
+[LIST]
 [*]In the Lua52 folder. Run the iuplua52.exe, which will give a little graphical dialog.
-[*]User the load button to navigate to the Histoffline.lua file. (Do not move it from its location or it won't be able to find its datafile.)
+[*]Use the load button to navigate to the Histoffline.lua file. (Do not move it from its location or it won't be able to find its datafile.)
 [*]Press "execute" to run it. If there is an error, please cut and paste into a message on the webpage so I can debug.
+[/LIST]

 [SIZE=3]Create Shortcuts[/SIZE]
-Now that you now it works, create a shortcut to run it directly from your desktop.
+Now that you know it works, create a shortcut to run it directly from your desktop.


 An Example shortcut is in the shortcuts folder. You can copy it to your desktop and edit it. A screenshot of the properties dialog is included.
diff --git a/history.lua b/history.lua
index 57ec4c1..537b2fd 100644
--- a/history.lua
+++ b/history.lua
@@ -227,8 +227,8 @@ local function setup_char()
 			begin = GetTimeStamp(),
 			time  = 0,		-- Accumulated time in Minutes
 			Ach_Points = GetEarnedAchievementPoints(),
-			deaths = 0,
-			map= {}
+			deaths = 0
+
 		}  -- end of defaults
 		load_history()
 		get_start()
@@ -308,8 +308,6 @@ function hist.Initialise(_, addOnName)
 			hist.me.maps = {}
 		end

-		hist.me.map = nil
-

 		    if hist.debug then
 					log("Begin Duplicate tests, Saved  -- Calculated" )
@@ -335,6 +333,12 @@ function hist.Initialise(_, addOnName)
 			hist.SV.data[hist.player].OverWrite = true
 		end
 	end
+	-- Fix bad map var.
+	if type(hist.me.levels[hist.me.level].map) == "table" then
+			hist.me.levels[hist.me.level].map = nil
+			d("History:  Fixed bad map key.")
+			log ("History:  Fixed bad map key.")
+	end
 	if hist.debug then
 		log_truncate(50)
 	else
diff --git a/history.txt b/history.txt
index 24a561a..d187304 100644
--- a/history.txt
+++ b/history.txt
@@ -1,6 +1,6 @@
 ## Title: Dad's History
 ## APIVersion: 100011
-## Version: 1
+## Version: Beta 3
 ## Author: HisDad
 ## Description: Record progress of all characters for offline viewing.
 ## SavedVariables: History_SV