fw4: fix crash in parse_cthelper() if no helpers are present
authorJo-Philipp Wich <jo@mein.io>
Mon, 13 Jun 2022 13:48:35 +0000 (15:48 +0200)
committerJo-Philipp Wich <jo@mein.io>
Tue, 14 Jun 2022 14:54:06 +0000 (16:54 +0200)
Properly deal with a possibly uninitialized helper object array.

Signed-off-by: Jo-Philipp Wich <jo@mein.io>
root/usr/share/ucode/fw4.uc

index db1e580ba0e9ee70c1e7bdb00213d819be074203..95e2540a74da869784f562dcada87c811eba51c2 100644 (file)
@@ -1037,7 +1037,7 @@ return {
                if (!rv)
                        return null;
 
-               let helper = filter(this.state.helpers, h => (h.name == rv.val))[0];
+               let helper = filter(this.state.helpers, h => (h.name == rv.val))?.[0];
 
                return helper ? { ...rv, ...helper } : null;
        },