Skip to content

Commit

Permalink
fix bad error handling for images not loaded by STBI
Browse files Browse the repository at this point in the history
  • Loading branch information
Eisenwave committed Feb 6, 2021
1 parent 4f1a155 commit 51f1794
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,12 @@ std::optional<Texture> loadTexture(const std::string &name, const std::string &m

std::string err;
std::optional<Image> image = voxelio::png::decode(*stream, 4, err);
if (not stream.has_value()) {
if (not image.has_value()) {
VXIO_LOG(WARNING, "Could open, but failed to decode texture \"" + name + "\" of material \"" + material + '"');
VXIO_LOG(WARNING, "Caused by STBI error: " + err);
return std::nullopt;
}
VXIO_ASSERT(err.empty());
image->setWrapMode(WrapMode::REPEAT);

VXIO_LOG(INFO, "Loaded texture \"" + name + "\"");
Expand Down

0 comments on commit 51f1794

Please sign in to comment.