luci-app-opkg: gracefully handle empty config files
authorJo-Philipp Wich <jo@mein.io>
Sun, 23 Feb 2020 20:16:23 +0000 (21:16 +0100)
committerJo-Philipp Wich <jo@mein.io>
Sun, 23 Feb 2020 20:16:59 +0000 (21:16 +0100)
Fixes: #3668
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
(cherry picked from commit 562425605af51443986cb2596199564e4102ffff)

applications/luci-app-opkg/htdocs/luci-static/resources/view/opkg.js

index 5442e794b070abba43dfcab732cf0f70e2507cba..c7cb55fc47fb7afd1dd11f043b69083c939a7fc3 100644 (file)
@@ -662,7 +662,7 @@ function handleConfig(ev)
                        body.push(E('h5', {}, '%h'.format(file)));
                        body.push(E('textarea', {
                                'name': file,
-                               'rows': Math.max(Math.min(conf[file].match(/\n/g).length, 10), 3)
+                               'rows': Math.max(Math.min(L.toArray(conf[file].match(/\n/g)).length, 10), 3)
                        }, '%h'.format(conf[file])));
                });