mirror of
https://github.com/joel16/NX-Shell.git
synced 2024-11-23 11:49:46 +00:00
gui: Verify the length of the constructed path before opening an image
This commit is contained in:
parent
a8c4018c88
commit
199ec66d29
@ -196,8 +196,6 @@ namespace GUI {
|
||||
return string;
|
||||
}
|
||||
|
||||
#define IM_CLAMP(V, MN, MX) ((V) < (MN) ? (MN) : (V) > (MX) ? (MX) : (V))
|
||||
|
||||
static void RenderPropertiesMenu(MenuItem *item) {
|
||||
ImGui::OpenPopup("Properties");
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(15, 15));
|
||||
@ -487,9 +485,11 @@ namespace GUI {
|
||||
if (file_type == FileTypeImage) {
|
||||
std::string path = std::string();
|
||||
int length = FS::ConstructPath(&item.entries[item.selected], path.data(), nullptr);
|
||||
bool image_ret = Textures::LoadImageFile(path, &texture);
|
||||
IM_ASSERT(image_ret);
|
||||
item.state = MENU_STATE_IMAGEVIEWER;
|
||||
if (length > 0) {
|
||||
bool image_ret = Textures::LoadImageFile(path, &texture);
|
||||
IM_ASSERT(image_ret);
|
||||
item.state = MENU_STATE_IMAGEVIEWER;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user