Skip to content

Commit

Permalink
feat: return nil if image file doesn't exist (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
lingsamuel authored Mar 2, 2025
1 parent 4bad63f commit 2660b68
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ void on_ref_lua_state_created(lua_State* l) try {
auto image_path = images_path / filepath;

std::filesystem::create_directories(images_path);
if (!std::filesystem::is_regular_file(image_path)) {
return std::shared_ptr<D2DImage>{nullptr};
}

return std::make_shared<D2DImage>(g_plugin->d2d->wic(), g_plugin->d2d->context(), image_path);
},
Expand Down

0 comments on commit 2660b68

Please sign in to comment.