git repos / saland

commit 1380e6a8

Poul Sander · 2026-05-25 12:25
1380e6a87c5eb4b641f9713344443005dc293456 patch · browse files
parent ac224c83b1397d28507778486061fd708e852ad8

Prevent selecting txt files in the editor. They will crash the editor

Changed files

M src/editor/SagoTextureSelector.cpp before
diff --git a/src/editor/SagoTextureSelector.cpp b/src/editor/SagoTextureSelector.cpp index 7d18b6e..af5bc27 100644 --- a/src/editor/SagoTextureSelector.cpp +++ b/src/editor/SagoTextureSelector.cpp
@@ -101,7 +101,8 @@ static void addFolderToList(const std::string& folder, std::vector<std::string>&
std::vector<std::string> textures = sago::GetFileList(folder.c_str());
for (const auto& texture : textures) {
std::cout << "Texture: " << texture << "\n";
- if (texture.find(".png") == std::string::npos) {
+ if (!texture.ends_with(".png") && !texture.ends_with(".jpg") &&
+ !texture.ends_with(".jpeg") && !texture.ends_with(".bmp")) {
continue;
}
if (filter.empty() || texture.find(filter) != std::string::npos) {