luci-app-hd-idle: Check disk opt value
authorJoseph Mory <morytyann@outlook.com>
Thu, 12 Dec 2024 14:52:02 +0000 (14:52 +0000)
committerPaul Donald <newtwen+github@gmail.com>
Thu, 12 Dec 2024 14:58:11 +0000 (15:58 +0100)
Signed-off-by: Joseph Mory <morytyann@outlook.com>
applications/luci-app-hd-idle/htdocs/luci-static/resources/view/hd_idle.js

index 247841e78275097a198f04c653ae3b55a7f2102b..b3df08913a5b78fa6a0538d06fa8d91dd7f85f52 100644 (file)
@@ -9,7 +9,7 @@ function disk(devs, options, section_id) {
        var disk = devs.find(function(itm){ return itm.name == v; });
        var out = '';
        if(disk != undefined){
-               out = options.map(function(opt){ return disk[opt].trim(); });
+               out = options.map(function(opt){ return disk[opt]?.trim() || null; });
                out = out.filter(function(o){ return o != ''; });
                out = out.join(' ');
        }