Skip to content

Commit

Permalink
50CC: Fix crash when a palette doesn't exist that should
Browse files Browse the repository at this point in the history
Also use VistaFolderBrowserDialog instead of FolderBrowserDialog
  • Loading branch information
soopercool101 committed Apr 30, 2024
1 parent fa6aae8 commit 72d5f9a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion BrawlCrate/NodeWrappers/Graphics/TEX0Wrapper.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using BrawlCrate.ExternalInterfacing;
using BrawlCrate.UI;
using BrawlLib.Internal.Windows.Forms;
using BrawlLib.Internal.Windows.Forms.Ookii.Dialogs;
using BrawlLib.SSBB;
using BrawlLib.SSBB.ResourceNodes;
using System;
Expand Down Expand Up @@ -319,7 +320,7 @@ public void ConvertToStock50()
}
}

if (tx0.HasPalette)
if (tx0.HasPalette && tx0.GetPaletteNode() != null)
{
tx0.GetPaletteNode().Name = "InfStc." + tx0.texSortNum.ToString("0000");
}
Expand Down Expand Up @@ -417,7 +418,11 @@ public void ConvertToStock50()

if (!autoFoundFolder)
{
#if MONO
FolderBrowserDialog f = new FolderBrowserDialog
#else
VistaFolderBrowserDialog f = new VistaFolderBrowserDialog
#endif
{
Description = "Select the \"portrite\" folder"
};
Expand Down

0 comments on commit 72d5f9a

Please sign in to comment.