[git]ShowErrorStack error fix v2

Where bugs go to lie down and rest

Moderator: Moderator

Post Reply
Message
Author
zhouwei_e
Cornac
Posts: 35
Joined: Tue Feb 14, 2012 10:01 am

[git]ShowErrorStack error fix v2

#1 Post by zhouwei_e »

Code: Select all

error = "Lua Error: /engine/dialogs/ShowErrorStack.lua:77: attempt to get length of field 'dialogs' (a nil value)\
  At [C]:-1 __len\
  At /engine/dialogs/ShowErrorStack.lua:77 init\
  At /engine/class.lua:97 new\
  At /engine/Game.lua:197 tick\
  At /engine/GameTurnBased.lua:42 tick\
  At /mod/class/Game.lua:904 "
fix it like this

Code: Select all

 .../default/engine/dialogs/ShowErrorStack.lua      |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/game/engines/default/engine/dialogs/ShowErrorStack.lua b/game/engines/default/engine/dialogs/ShowErrorStack.lua
index ffccb6a..b7858f3 100644
--- a/game/engines/default/engine/dialogs/ShowErrorStack.lua
+++ b/game/engines/default/engine/dialogs/ShowErrorStack.lua
@@ -65,8 +65,8 @@ If you are not currently connected to the internet, please report this bug when
 	local ok = require("engine.ui.Button").new{text="Send", fct=function() self:send() end}
 	local cancel = require("engine.ui.Button").new{text="Close", fct=function() game:unregisterDialog(self) end}
 	local cancel_all = require("engine.ui.Button").new{text="Close All", fct=function()
-		for i = #self.dialogs, 1, -1 do
-			local d = self.dialogs[i]
+		for i = #game.dialogs, 1, -1 do
+			local d = game.dialogs[i]
 			if d.__CLASSNAME == "engine.dialogs.ShowErrorStack" then
 				game:unregisterDialog(d)
 			end
@@ -74,7 +74,7 @@ If you are not currently connected to the internet, please report this bug when
 	end}
 
 	local many_errs = false
-	for i = #self.dialogs, 1, -1 do local d = self.dialogs[i] if d.__CLASSNAME == "engine.dialogs.ShowErrorStack" then many_errs = true break end end
+	for i = #game.dialogs, 1, -1 do local d = game.dialogs[i] if d.__CLASSNAME == "engine.dialogs.ShowErrorStack" then many_errs = true break end end
 
 	local uis = {
 		{left=0, top=0, padding_h=10, ui=errmsg},
but i don't know is that true?
Last edited by zhouwei_e on Sun Mar 18, 2012 4:53 pm, edited 1 time in total.

zhouwei_e
Cornac
Posts: 35
Joined: Tue Feb 14, 2012 10:01 am

Re: [git]ShowErrorStack error fix?

#2 Post by zhouwei_e »

Code: Select all

 .../default/engine/dialogs/ShowErrorStack.lua      |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/game/engines/default/engine/dialogs/ShowErrorStack.lua b/game/engines/default/engine/dialogs/ShowErrorStack.lua
index ffccb6a..5df6fc2 100644
--- a/game/engines/default/engine/dialogs/ShowErrorStack.lua
+++ b/game/engines/default/engine/dialogs/ShowErrorStack.lua
@@ -74,8 +74,16 @@ If you are not currently connected to the internet, please report this bug when
 	end}
 
 	local many_errs = false
-	for i = #self.dialogs, 1, -1 do local d = self.dialogs[i] if d.__CLASSNAME == "engine.dialogs.ShowErrorStack" then many_errs = true break end end
-
+	if self.dialogs then
+		for i = #self.dialogs, 1, -1 do
+			local d = self.dialogs[i] 
+			if d.__CLASSNAME == "engine.dialogs.ShowErrorStack" then 
+				many_errs = true 
+				break
+			end
+		end
+	end
+	
 	local uis = {
 		{left=0, top=0, padding_h=10, ui=errmsg},
 		{left=0, top=errmsg.h + 10, padding_h=10, ui=errzone},

Post Reply