[Server Crash] - Lua Crash when examining mole


Zackreaver

Recommended Posts

Bug Submission:

Category: Server Crash

Issue Title: Lua Crash when examining mole

Issue Description: [00:01:31]: [string "scripts/stringutil.lua"]:5: attempt to index local 'ret' (a nil value)

LUA ERROR stack traceback:

scripts/stringutil.lua:5 in () ? (Lua) <1-13>

topic_tab = table: 0CA2C210

modifier = table: 3932BFA8

ret = nil

i = 2

v = UNDERGROUND

=(tail call):-1 in () (tail) <-1--1>

This crash only really happens with modded characters who have a custom speech file.

Before the release of reign of giants, a good portion of modded characters made are using old speech files which don't contain lines for some of the new content.

For the most part, it defaults to wilson's just fine, except for this case where if you examine a Mole who is currently moving underground, if there's no MOLE table in the speech file, it will give this error.

I feel like this function could be better equipped to avoid indexing a nil string in the event of these strange errors

local function getmodifiedstring(topic_tab, modifier)

if type(modifier) == "table" then

local ret = topic_tab

for i,v in ipairs(modifier) do

ret = ret[v]

end

return ret

else

return (modifier ~= nil and topic_tab[modifier])

or topic_tab.GENERIC

or (#topic_tab > 0 and topic_tab[math.random(#topic_tab)] or nil)

end

end

should have

if ret then

ret = ret[v]

end

Alternatively, there might be something wierd going on with the Mole Dirt Mound's inspection.

In the mean time, modders should beware to update their old characters speech files with up to date lines.

Steps to Reproduce: With a modded character who's missing the DESCRIBE.MOLE speech table.

attempt to inspect a mole who is underground AND moving.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.