From ef2db82764e2c2bf535d106668e6c10ad7f5542c Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 20 Feb 2011 19:03:58 +0000
Subject: [PATCH] fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@2770 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/engines/default/engine/ui/List.lua         | 16 ++++++++--------
 game/engines/default/engine/ui/ListColumns.lua  | 14 +++++++-------
 game/engines/default/engine/ui/TreeList.lua     | 14 +++++++-------
 game/engines/default/engine/ui/VariableList.lua |  6 +++---
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/game/engines/default/engine/ui/List.lua b/game/engines/default/engine/ui/List.lua
index 725f26f84c..0094d55ecf 100644
--- a/game/engines/default/engine/ui/List.lua
+++ b/game/engines/default/engine/ui/List.lua
@@ -119,39 +119,39 @@ function _M:generate()
 		if button == "wheelup" and event == "button" then self.scroll = util.bound(self.scroll - 1, 1, self.max - self.max_display + 1)
 		elseif button == "wheeldown" and event == "button" then self.scroll = util.bound(self.scroll + 1, 1, self.max - self.max_display + 1) end
 
-		if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+		if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 		self.sel = util.bound(self.scroll + math.floor(by / self.fh), 1, self.max)
 		if (self.all_clicks or button == "left") and event == "button" then self:onUse(button) end
 	end)
 	self.key:addBinds{
 		ACCEPT = function() self:onUse() end,
 		MOVE_UP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 		end,
 		MOVE_DOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 		end,
 	}
 	self.key:addCommands{
 		_HOME = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = 1
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 		end,
 		_END = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = self.max
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 		end,
 		_PAGEUP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.bound(self.sel - self.max_display, 1, self.max)
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 		end,
 		_PAGEDOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.bound(self.sel + self.max_display, 1, self.max)
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 		end,
@@ -159,7 +159,7 @@ function _M:generate()
 end
 
 function _M:select(i)
-	if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+	if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 	self.sel = util.bound(i, 1, #self.list)
 	self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 end
diff --git a/game/engines/default/engine/ui/ListColumns.lua b/game/engines/default/engine/ui/ListColumns.lua
index e3d6ce659f..6335070d1e 100644
--- a/game/engines/default/engine/ui/ListColumns.lua
+++ b/game/engines/default/engine/ui/ListColumns.lua
@@ -188,7 +188,7 @@ function _M:generate()
 		if button == "wheelup" and event == "button" then self.scroll = util.bound(self.scroll - 1, 1, self.max - self.max_display + 1)
 		elseif button == "wheeldown" and event == "button" then self.scroll = util.bound(self.scroll + 1, 1, self.max - self.max_display + 1) end
 
-		if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+		if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 		self.sel = util.bound(self.scroll + math.floor(by / self.fh), 1, self.max)
 		self:onSelect()
 		if (self.all_clicks or button == "left") and event == "button" then self:onUse(button, event) end
@@ -196,35 +196,35 @@ function _M:generate()
 	self.key:addBinds{
 		ACCEPT = function() self:onUse("left", "key") end,
 		MOVE_UP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
 		end,
 		MOVE_DOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
 		end,
 	}
 	self.key:addCommands{
 		_HOME = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = 1
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
 		end,
 		_END = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = self.max
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
 		end,
 		_PAGEUP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.bound(self.sel - self.max_display, 1, self.max)
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
 		end,
 		_PAGEDOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.bound(self.sel + self.max_display, 1, self.max)
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
diff --git a/game/engines/default/engine/ui/TreeList.lua b/game/engines/default/engine/ui/TreeList.lua
index 10c04b34b9..41a6fdc7a2 100644
--- a/game/engines/default/engine/ui/TreeList.lua
+++ b/game/engines/default/engine/ui/TreeList.lua
@@ -203,7 +203,7 @@ function _M:generate()
 		if button == "wheelup" and event == "button" then self.scroll = util.bound(self.scroll - 1, 1, self.max - self.max_display + 1)
 		elseif button == "wheeldown" and event == "button" then self.scroll = util.bound(self.scroll + 1, 1, self.max - self.max_display + 1) end
 
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 		self.sel = util.bound(self.scroll + math.floor(by / self.fh), 1, self.max)
 		if self.sel_by_col then
 			for i = 1, #self.sel_by_col do if bx > (self.sel_by_col[i-1] or 0) and bx <= self.sel_by_col[i] then
@@ -221,11 +221,11 @@ function _M:generate()
 	self.key:addBinds{
 		ACCEPT = function() self:onUse("left") end,
 		MOVE_UP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel - 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
 		end,
 		MOVE_DOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel + 1, 1, self.max) self.scroll = util.scroll(self.sel, self.scroll, self.max_display) self:onSelect()
 		end,
 	}
@@ -237,25 +237,25 @@ function _M:generate()
 	end
 	self.key:addCommands{
 		_HOME = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = 1
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
 		end,
 		_END = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = self.max
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
 		end,
 		_PAGEUP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.bound(self.sel - self.max_display, 1, self.max)
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
 		end,
 		_PAGEDOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.bound(self.sel + self.max_display, 1, self.max)
 			self.scroll = util.scroll(self.sel, self.scroll, self.max_display)
 			self:onSelect()
diff --git a/game/engines/default/engine/ui/VariableList.lua b/game/engines/default/engine/ui/VariableList.lua
index 18d897544f..70e3d91201 100644
--- a/game/engines/default/engine/ui/VariableList.lua
+++ b/game/engines/default/engine/ui/VariableList.lua
@@ -85,7 +85,7 @@ function _M:generate()
 		item._stex = ss:glTexture()
 
 		self.mouse:registerZone(0, self.h, self.w, fh, function(button, x, y, xrel, yrel, bx, by, event)
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = i
 			self:onSelect()
 			if button == "left" and event == "button" then self:onUse() end
@@ -98,11 +98,11 @@ function _M:generate()
 	self.key:addBinds{
 		ACCEPT = function() self:onUse() end,
 		MOVE_UP = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel - 1, 1, self.max) self:onSelect()
 		end,
 		MOVE_DOWN = function()
-			if self.sel then self.list[self.sel].focus_decay = self.focus_decay_max end
+			if self.sel and self.list[self.sel] then self.list[self.sel].focus_decay = self.focus_decay_max end
 			self.sel = util.boundWrap(self.sel + 1, 1, self.max) self:onSelect()
 		end,
 	}
-- 
GitLab