Page 9 of 9

Re: [Release] Navigation MFD

Posted: Thu Jun 27, 2024 4:20 pm
by Nite Owl
Been getting a bunch of these lately.

Code: Select all

[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (navi_mfd 1.9.2): TypeError: whom.target is null
Which has been traced back to this bit of code (line 388 in notepad++) from the script.js file (config folder) in this OXZ.

Code: Select all

// Tracker OXP
		else if (this.$targetName === "Tracker") {
			if (whom.target.displayName)
				this.$targetName = whom.target.displayName;
			else this.$targetName = whom.target.name;
			this.$targetName += " (Tracked)";
		}
The only TWEAKS made to this file are changing the km and kilometer references to Kiloometers at the very beginning of the file. This is a standard practice of mine and has caused no other similar problems. Why the error is being generated is beyond me. Any and all help would be deeply appreciated.

Re: [Release] Navigation MFD

Posted: Thu Jun 27, 2024 5:03 pm
by hiran
Looking at your error

Code: Select all

[script.javaScript.exception.unexpectedType]: ***** JavaScript exception (navi_mfd 1.9.2): TypeError: whom.target is null
and the code line

Code: Select all

			if (whom.target.displayName)
what would you expect as a result if whom.target is null?
Or in other words: What would

Code: Select all

			if (null.displayName)
give as result?

Re: [Release] Navigation MFD

Posted: Thu Jun 27, 2024 10:23 pm
by phkb
I’ll investigate why “whom” is null tonight sometime.

Re: [Release] Navigation MFD

Posted: Thu Jun 27, 2024 10:30 pm
by hiran
phkb wrote: Thu Jun 27, 2024 10:23 pm
I’ll investigate why “whom” is null tonight sometime.
I guess whom is not null but whom.target is.
So better check borh.

Re: [Release] Navigation MFD

Posted: Mon Jul 01, 2024 12:01 am
by phkb
After some investigation, it appears that "whom.target" is the thing that is null. In this instance, "whom" is a tracker entity from the Tracker OXP, and if everything is working how Tracker expected it to, then the tracker ship entity would always have a "target" property populated with the target it's supposed to be tracking. But obviously, in this example, it has returned null. Based on my reading of the Tracker OXP, that situation shouldn't happen, although there might exist a chance between frames where a tracker is being spawned but the target hasn't been assigned.

But that's just from my reading of the code. I haven't tested this yet, and I don't normally play with Tracker OXP, so I'll need to set it up. More updates to follow.