修复无用户信息时主菜单获取临时头像报错
This commit is contained in:
@@ -28,18 +28,18 @@ for i=1,29 do
|
|||||||
end
|
end
|
||||||
|
|
||||||
local db_img={}
|
local db_img={}
|
||||||
local db=setmetatable({},{__index=function(self,k)
|
local db=setmetatable({},{__index=function(self,uid)
|
||||||
if not k then
|
if not uid then
|
||||||
db_img[k]=defaultAvatar[(k-26)%29+1]
|
db_img[uid]=defaultAvatar[1]
|
||||||
return emptyUser
|
return emptyUser
|
||||||
end
|
end
|
||||||
local file="cache/user"..k..".dat"
|
local file="cache/user"..uid..".dat"
|
||||||
local d=fs.getInfo(file)and JSON.decode(fs.read(file))or TABLE.copy(emptyUser)
|
local d=fs.getInfo(file)and JSON.decode(fs.read(file))or TABLE.copy(emptyUser)
|
||||||
rawset(self,k,d)
|
rawset(self,uid,d)
|
||||||
db_img[k]=
|
db_img[uid]=
|
||||||
type(d.hash)=="string"and #d.hash>0 and fs.getInfo("cache/"..d.hash)and
|
type(d.hash)=="string"and #d.hash>0 and fs.getInfo("cache/"..d.hash)and
|
||||||
loadAvatar("cache/"..d.hash)or
|
loadAvatar("cache/"..d.hash)or
|
||||||
defaultAvatar[(k-26)%29+1]
|
defaultAvatar[(uid-26)%29+1]
|
||||||
return d
|
return d
|
||||||
end})
|
end})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user