Skip to content

global.lua crash-loops every onUpdate on OpenMW 0.51.0 (cell.region is now nil, not empty string, for regionless cells) #5

Description

@cwilliams-98

This report was drafted by an AI assistant (Claude) on my behalf, based on analysis of my openmw.log — I'm not a programmer or an experienced Morrowind modder, so please bear with me if there are follow-up technical questions.

Environment

  • OpenMW 0.51.0 (Windows)
  • Large mod list including Tamriel Rebuilt + OAAB (many interior and mainland cells)

Symptom

scripts/DynamicMusic/global.lua throws on essentially every engine tick for the entire play session:

Global[scripts/dynamicmusic/global.lua] onUpdate failed. Lua error: [string "scripts/dynamicmusic/global.lua"]:25: table index is nil

In one ~2.5 hour session this logged 1,058,943 times, from shortly after load until quit — it never stops or self-heals.

Root cause

sendGlobalData() does:

for _, cell in ipairs(world.cells) do
  if cell.name ~= '' then
    table.insert(cellNames, cell.name)
  end
  regionNamesSet[cell.region] = true   -- line 25
end

cell.region is nil for any cell with no region (all interior cells, for example). Indexing a table with a nil key is a hard Lua error, so this throws the moment the loop hits the first such cell.

This used to be safe because OpenMW's Lua API returned an empty string "" for a regionless cell rather than nil — a valid table key. OpenMW 0.51.0 changed that: per the 0.51.0 release notes and GitLab #8718 ("Cell fields can still return empty strings instead of nil values"), empty CellT fields — including region — are now consistently exposed as nil. The current docs confirm this: "Region of the cell (can be nil)." So this script silently broke as a side effect of upgrading to 0.51.0, not because of anything mod-list-specific.

Because the error happens inside sendGlobalData, execution never reaches players[player.id] = true in onUpdate, so the "already sent" guard never gets set — the mod retries (and fails) again on every subsequent tick for the rest of the session.

Suggested fix

Guard the nil case before using it as a key:

if cell.region then
  regionNamesSet[cell.region] = true
end

Happy to test a fix if useful. Thanks for the mod!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions