luci-base: fix null error
authorPaul Donald <redacted>
Sat, 17 Jan 2026 15:58:26 +0000 (16:58 +0100)
committerPaul Donald <redacted>
Sun, 18 Jan 2026 17:14:41 +0000 (18:14 +0100)
When working with JSONMap backed data sources in tables, sort
triggers a null error because this.state is not available.
Prevent the null error if it is unavailable.

Signed-off-by: Paul Donald <redacted>
modules/luci-base/htdocs/luci-static/resources/uci.js

index c0b5e97be0f11fa42d669abe8856cffc75608560..16baebda5fc03a4dd4c90353bb19acb5ebb0c5de 100644 (file)
@@ -871,7 +871,8 @@ return baseclass.extend(/** @lends LuCI.uci.prototype */ {
                for (let i = 0; i < sa.length; i++)
                        this.get(conf, sa[i]['.name'])['.index'] = i;
 
-               this.state.reorder[conf] = true;
+               if (this.state)
+                       this.state.reorder[conf] = true;
 
                return true;
        },
git clone https://git.99rst.org/PROJECT