File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,18 +219,22 @@ std::string computeTildeUpperBound(const std::string_view &version) {
219219
220220 if (!coercedOpt) return " " ;
221221
222- std::string_view version = coercedOpt.value (); // For example "1.1.1"
223222 std::vector<std::string> parts;
224223 std::istringstream iss (*coercedOpt);
225224 std::string token;
226225
227226 size_t pos = 0 ;
228227 size_t dot_pos;
229- while ((dot_pos = version.find (' .' , pos)) != std::string::npos) {
228+ while (pos < version.size () &&
229+ (dot_pos = version.find (' .' , pos)) != std::string::npos) {
230230 parts.push_back (std::string (version.substr (pos, dot_pos - pos)));
231231 pos = dot_pos + 1 ;
232232 }
233233
234+ if (pos < version.size ()) {
235+ parts.push_back (std::string (version.substr (pos)));
236+ }
237+
234238 int major = std::stoi (parts[0 ]);
235239 int minor = std::stoi (parts[1 ]);
236240
You can’t perform that action at this time.
0 commit comments