Skip to content

Commit

Permalink
TextureAtlasEditor - Fix argument null exception when populating vari…
Browse files Browse the repository at this point in the history
…ant combo box
  • Loading branch information
NessieHax committed Jul 3, 2024
1 parent 35abbe8 commit 9a37eac
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions PCK-Studio/Forms/Editor/TextureAtlasEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
**/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
Expand Down Expand Up @@ -228,8 +229,6 @@ private void SetImageDisplayed(int index)
selectTilePictureBox.BlendColor = GetBlendColor();
selectTilePictureBox.UseBlendColor = applyColorMaskToolStripMenuItem.Checked;



tileNameLabel.Text = $"{dataTile.Tile.DisplayName}";
internalTileNameLabel.Text = $"{dataTile.Tile.InternalName}";

Expand All @@ -255,10 +254,9 @@ private void SetImageDisplayed(int index)

setColorButton.Enabled = dataTile.Tile.AllowCustomColour;

if (setColorButton.Enabled)
variantComboBox.Enabled = variantComboBox.Visible = dataTile.Tile.HasColourEntry && dataTile.Tile.ColourEntry?.Variants?.Length > 1;
if (variantComboBox.Enabled)
{
variantComboBox.Enabled = variantComboBox.Visible = dataTile.Tile.ColourEntry.Variants.Length > 1;

if (dataTile.Tile.ColourEntry.IsWaterColour)
{
foreach (ColorContainer.WaterColor col in _colourTable.WaterColors)
Expand All @@ -268,6 +266,7 @@ private void SetImageDisplayed(int index)
}
}

// TODO: only add variants that are available in the color table
variantComboBox.Items.AddRange(dataTile.Tile.ColourEntry.Variants);

if (variantComboBox.Items.Count > 0)
Expand Down Expand Up @@ -445,6 +444,7 @@ private Color FindBlendColorByKey(string colorKey)
}
}

Debug.WriteLine("Could not find: " + colorKey);
return Color.White;
}

Expand Down

0 comments on commit 9a37eac

Please sign in to comment.