mirror of
https://github.com/gbdev/rgbds.git
synced 2026-08-19 21:34:31 +00:00
Fix crash on image without any colors (all transparent)
This commit is contained in:
@@ -279,6 +279,8 @@ static void verboseOutputAssignments(
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
static void decant(std::vector<AssignedSets> &assignments, std::vector<ColorSet> const &colorSets) {
|
||||
assume(!assignments.empty());
|
||||
|
||||
// "Decanting" is the process of moving all *things* that can fit in a lower index there
|
||||
auto decantOn = [&assignments](auto const &tryDecanting) {
|
||||
// No need to attempt decanting on palette #0, as there are no palettes to decant to
|
||||
|
||||
@@ -377,6 +377,7 @@ static std::pair<std::vector<size_t>, std::vector<Palette>>
|
||||
pal.addColor(color);
|
||||
}
|
||||
}
|
||||
assume(!palettes.empty());
|
||||
|
||||
// "Sort" colors in the generated palettes, see the man page for the flowchart
|
||||
if (options.palSpecType == Options::DMG) {
|
||||
@@ -1150,6 +1151,10 @@ continue_visiting_tiles:;
|
||||
}
|
||||
// LCOV_EXCL_STOP
|
||||
|
||||
if (colorSets.empty()) {
|
||||
fatal("Image does not contain any colors");
|
||||
}
|
||||
|
||||
if (options.palSpecType == Options::EMBEDDED) {
|
||||
generatePalSpec(image);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
FATAL: Image does not contain any colors
|
||||
Conversion aborted after 1 error
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 355 B |
Reference in New Issue
Block a user