Skip to content

Commit

Permalink
Merge pull request #9 from bwrsandman/no_ext
Browse files Browse the repository at this point in the history
Fix crash when selected file has not ext
  • Loading branch information
gallickgunner authored Feb 12, 2020
2 parents 1b28525 + 4332298 commit b48086f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions FileBrowser/ImGuiFileBrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,9 +720,9 @@ namespace imgui_addons

bool ImGuiFileBrowser::validateFile()
{
int idx = selected_fn.find_last_of(".");
std::string ext = selected_fn.substr(idx, selected_fn.length() - idx);
return (std::find(valid_exts.begin(), valid_exts.end(), ext) != valid_exts.end());
int idx = selected_fn.find_last_of('.');
std::string file_ext = idx == std::string::npos ? "" : selected_fn.substr(idx, selected_fn.length() - idx);
return (std::find(valid_exts.begin(), valid_exts.end(), file_ext) != valid_exts.end());
}

void ImGuiFileBrowser::parsePathTabs(std::string path)
Expand Down

0 comments on commit b48086f

Please sign in to comment.