WazWaz / EnvironmentalVisualEnhancements

Visual enhancements including clouds, lights, etc.
71 stars 21 forks source link

NullReferenceException in RemoveFromPQSCities #19

Closed k-dueb closed 5 years ago

k-dueb commented 5 years ago

Hi!

NullReferenceException in RemoveFromPQSCities:

System.NullReferenceException: Object reference not set to an instance of an object
  at Utils.MaterialPQS.RemoveFromPQSCities () [0x00000] in <filename unknown>:0 
  at Utils.MaterialPQS.Remove () [0x00000] in <filename unknown>:0 
  at CelestialShadows.ShadowObject.Remove () [0x00000] in <filename unknown>:0 
  at EVEManager.GenericEVEManager`1[T].Clean () [0x00000] in <filename unknown>:0 
  at EVEManager.EVEManagerBase.Apply () [0x00000] in <filename unknown>:0 
  at EVEManager.EVEManagerBase.LoadConfig () [0x00000] in <filename unknown>:0 
  at EVEManager.GenericEVEManager`1[T].Setup () [0x00000] in <filename unknown>:0 
  at CelestialShadows.ShadowManager.Setup () [0x00000] in <filename unknown>:0 
  at EVEManager.GlobalEVEManager.Setup (Boolean late) [0x00000] in <filename unknown>:0 

It looks like it is caused by the lack of null-check on this.sphere. RemoveFromPQSCities being called by Remove, I suggest to split the existing null-check on this.sphere and replace it by something like:

            if (this.sphere != null)
            {
                RemoveFromPQSCities();
                if (this.sphere.quads != null)
                {
WazWaz commented 5 years ago

Does this always occur? Otherwise, in what situations to reproduce?

k-dueb commented 5 years ago

My bad!

So, yes: it always occurs. I have it happening when going back to Main menu from KSC.

But the problem doesn't seem to be EVE: I overlooked my installation folder and didn't noticed I left Scatterer and SVE in it!

When removing Scatterer, the problem disappear! So I suppose it have something to do with this error...

Again: sorry!

WazWaz commented 5 years ago

The fix is correct regardless, so I'll post it in a new update soon. We all use Scatterer :-)

k-dueb commented 5 years ago

Ahah! So true! xD Thank you! ;-)