Custom Walls And Floors (CWF)

Custom Walls And Floors (CWF)

8k Downloads

NullResourceException using CustomTV

Sakorona opened this issue ยท 2 comments

commented

Calling code:

` CustomTVMod.addChannel("Weather", "Weather Report", DisplayWeather);
}
}

    public void DisplayWeather(TV tv, TemporaryAnimatedSprite sprite, StardewValley.Farmer who, string answer)
    {
        TemporaryAnimatedSprite BackgroundSprite = new TemporaryAnimatedSprite(Game1.mouseCursors, new Rectangle(497, 305, 42, 28), 9999f, 1, 999999, tv.getScreenPosition(), false, false, (float)((double)(tv.boundingBox.Bottom - 1) / 10000.0 + 9.99999974737875E-06), 0.0f, Color.White, tv.getScreenSizeModifier(), 0.0f, 0.0f, 0.0f, false);
        TemporaryAnimatedSprite WeatherSprite = DescriptionEngine.GetWeatherOverlay(tv);
        string OnScreenText = "Test Text.";

        if (BackgroundSprite is null)
            Monitor.Log("Background Sprite is null");
        if (WeatherSprite is null)
            Monitor.Log("Weather Sprite is null");

        CustomTVMod.showProgram(BackgroundSprite, OnScreenText, CustomTVMod.endProgram, WeatherSprite);
    }`

Produces:
[08:45:10 TRACE Custom TV] Select Channel:Weather [08:45:10 ERROR SMAPI] An error occured in the base update loop: System.NullReferenceException: Object reference not set to an instance of an object. at CustomTV.TVIntercept.showProgram(TemporaryAnimatedSprite sprite, String text, Action afterDialogues, TemporaryAnimatedSprite overlay) in C:\Users\David\Documents\GitHub\Stardew-Valley-Mods\CustomTV\TVIntercept.cs:line 176 at CustomTV.CustomTVMod.showProgram(TemporaryAnimatedSprite sprite, String text, Action afterDialogues, TemporaryAnimatedSprite overlay) in C:\Users\David\Documents\GitHub\Stardew-Valley-Mods\CustomTV\CustomTVMod.cs:line 130 at ClimatesOfFerngillRebuild.ClimatesOfFerngill.DisplayWeather(TV tv, TemporaryAnimatedSprite sprite, Farmer who, String answer) in C:\Users\Kylindra\Source\SDVMods\ClimatesOfFerngill\ClimatesOfFerngillRebuild.cs:line 177 at CustomTV.TVIntercept.selectChannel(Farmer who, String answer) in C:\Users\David\Documents\GitHub\Stardew-Valley-Mods\CustomTV\TVIntercept.cs:line 228 at StardewValley.GameLocation.answerDialogue(Response answer) at StardewValley.Menus.DialogueBox.receiveLeftClick(Int32 x, Int32 y, Boolean playSound) at StardewValley.Game1.updateActiveMenu(GameTime gameTime) at StardewValley.Game1.Update(GameTime gameTime) at StardewModdingAPI.Framework.SGame.Update(GameTime gameTime) in C:\source\_Stardew\SMAPI\src\SMAPI\Framework\SGame.cs:line 550 [08:45:11 TRACE Custom TV] Select Channel:leave
Oddly, it also does this:

https://koihimenakamura.tinytake.com/sf/MjE3MDYyMF82NzU1NDI5

commented

SMAPI-latest.txt

Attached is the error log from that run.

commented

Testing: It only appears if I load from a save file with the CustomTV serialized.

That is: CEHe/Item/CustomTV.TVIntercept, CustomTV, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null/name=Floor TV -> Floor TV and changing the DisplayName fixes it.