File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -456,8 +456,17 @@ namespace mamba::specs
456456 }
457457
458458 pos = str.find_last_of (' =' );
459- const char d = str[pos - 1 ];
459+ if (pos == str.npos )
460+ {
461+ // That means that there is no operator, and version and build are separated with
462+ // space(s)
463+ pos = str.find_last_of (' ' );
464+ return { util::strip (str.substr (0 , pos)), str.substr (pos + 1 ) };
465+ }
460466
467+ assert (pos != str.npos );
468+ assert (pos < str.size ());
469+ const char d = str[pos - 1 ];
461470 if (d == ' =' || d == ' !' || d == ' |' || d == ' ,' || d == ' <' || d == ' >' || d == ' ~' )
462471 {
463472 // Find the position of the first non-space character after operator
@@ -475,14 +484,6 @@ namespace mamba::specs
475484 return { str, {} };
476485 }
477486
478- if (pos == str.npos )
479- {
480- // That means that there is no operator, and version and build are separated with
481- // space(s)
482- pos = str.find_last_of (' ' );
483- return { util::strip (str.substr (0 , pos)), str.substr (pos + 1 ) };
484- }
485-
486487 // '=' is found but not combined with `d` above
487488 // meaning that the build is right after the last '='
488489 const auto build_start = str.find_first_not_of (' ' , pos + 1 );
You can’t perform that action at this time.
0 commit comments