Add error handling to SnesPalette and SnesColor member fns

This commit is contained in:
scawful
2024-04-07 12:07:47 -04:00
parent f28e33b5d0
commit 03a38fc712
19 changed files with 188 additions and 117 deletions

View File

@@ -69,10 +69,9 @@ class SnesPalette {
size_++;
}
auto GetColor(int i) const {
absl::StatusOr<SnesColor> GetColor(int i) const {
if (i > size_) {
std::cout << "SNESPalette: Index out of bounds" << std::endl;
return colors[0];
return absl::InvalidArgumentError("SnesPalette: Index out of bounds");
}
return colors[i];
}