From 76abbe97f637398601d69799e3dbe5affe2f0a56 Mon Sep 17 00:00:00 2001 From: David Kocik Date: Mon, 17 Jan 2022 11:14:30 +0100 Subject: [PATCH] fix of of unchecked substr in Upload Dialog possible fix of #7681 --- src/slic3r/GUI/PrintHostDialogs.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/PrintHostDialogs.cpp b/src/slic3r/GUI/PrintHostDialogs.cpp index af2494dc8..9d80f9dd4 100644 --- a/src/slic3r/GUI/PrintHostDialogs.cpp +++ b/src/slic3r/GUI/PrintHostDialogs.cpp @@ -75,8 +75,9 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path, PrintHostPostUplo txt_filename->SetValue(recent_path); txt_filename->SetFocus(); - - m_valid_suffix = recent_path.substr(recent_path.find_last_of('.')); + + if (size_t extension_start = recent_path.find_last_of('.'); extension_start != std::string::npos) + m_valid_suffix = recent_path.substr(extension_start); // .gcode suffix control auto validate_path = [this](const wxString &path) -> bool { if (! path.Lower().EndsWith(m_valid_suffix.Lower())) {