Skip to content

Commit a213ef2

Browse files
www/js/Main.js: add null check for entity before accessing label in update function.
1 parent 106cfb3 commit a213ef2

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

www/js/Main.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,12 @@ Main.prototype.update = function () {
335335
for (i in g_data.dune_messages) {
336336
var msg = g_data.dune_messages[i];
337337
if (msg.abbrev == 'EntityInfo') {
338-
var name = g_data.dune_entities[msg.src_ent].label;
338+
const ent = g_data.dune_entities[msg.src_ent];
339+
if (!ent) {
340+
continue;
341+
}
342+
343+
var name = ent.label;
339344
if (name == 'GPS') {
340345
GPS_srcEntity_id = msg.src_ent;
341346
}

0 commit comments

Comments
 (0)