Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRE spam on compiling internal spaces #33

Closed
JonnyOThan opened this issue Feb 24, 2024 · 9 comments
Closed

NRE spam on compiling internal spaces #33

JonnyOThan opened this issue Feb 24, 2024 · 9 comments
Assignees
Labels

Comments

@JonnyOThan
Copy link

[EXC 13:11:07.644] NullReferenceException: Object reference not set to an instance of an object
    FlightGlobals.get_ActiveVessel () (at <4b449f2841f84227adfaad3149c8fdba>:0)
    Astrogator.AstrogatorMenu..ctor () (at <53d746b99efb4192a3e3b763aab2ce34>:0)
    UnityEngine.DebugLogHandler:LogException(Exception, Object)
    ModuleManager.UnityLogHandle.InterceptLogHandler:LogException(Exception, Object)
    UnityEngine.Object:Instantiate(InternalProp)
    PartLoader:GetInternalProp(String)
    InternalModel:AddProp(ConfigNode)
    InternalModel:Load(ConfigNode)
    PartLoader:LoadInternalSpace(UrlConfig)
    <CompileInternalSpaces>d__79:MoveNext()
    KSPCommunityFixes.Performance.<FrameUnlockedCoroutine>d__62:MoveNext()
    KSPCommunityFixes.Performance.<PartLoader_CompileAll>d__58:MoveNext()
    UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

KSP - 2024-02-24T132234.261.log.zip

@HebaruSan
Copy link
Owner

@JonnyOThan how do I reproduce this?

@JonnyOThan
Copy link
Author

I’m pretty sure you just have RPM and an IVA with a MFD installed (e.g. DE_IVA)

@HebaruSan
Copy link
Owner

And KSPCommunityFixes presumably, since it's in the stack trace? Any others?

@JonnyOThan
Copy link
Author

I doubt KSPCF is required, that’s just the fast loader patch.

@HebaruSan
Copy link
Owner

Hmm, does this exception actually happen without that mod?

@JonnyOThan
Copy link
Author

JonnyOThan commented Jun 17, 2024

Without KSPCF? I would be shocked if it didn't. KSPCF is calling the same stock loading methods but just in a different loop structure so that it doesn't get throttle by unity's coroutine logic.

@HebaruSan

This comment was marked as resolved.

@HebaruSan HebaruSan added the bug label Jun 17, 2024
@HebaruSan
Copy link
Owner

HebaruSan commented Jun 23, 2024

It looks like this property can throw an NRE if UnityEngine.Object.FindObjectOfType can't find a FlightGlobals object:

public class FlightGlobals : MonoBehaviour
{
	// ...
	public static FlightGlobals fetch
	{
		get
		{
			if (_fetch == null)
			{
				_fetch = (FlightGlobals)UnityEngine.Object.FindObjectOfType(typeof(FlightGlobals));
			}
			return _fetch;
		}
	}
	// ...
	public static Vessel ActiveVessel => fetch.activeVessel;

I have no idea when that might be possible. I guess I'll just slap on an "ignore NREs" wrapper.

@HebaruSan HebaruSan changed the title NRE spam on compilling internal spaces NRE spam on compiling internal spaces Jun 24, 2024
@HebaruSan
Copy link
Owner

Re-opening because this probably wasn't actually fixed.

@HebaruSan HebaruSan reopened this Jun 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants