diff --git a/src/Plugin.cpp b/src/Plugin.cpp index 5937963..ec98bc7 100644 --- a/src/Plugin.cpp +++ b/src/Plugin.cpp @@ -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{nullptr}; + } return std::make_shared(g_plugin->d2d->wic(), g_plugin->d2d->context(), image_path); },