aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/search-path.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libexpr/search-path.cc b/src/libexpr/search-path.cc
index 36bb4c3a5..180d5f8b1 100644
--- a/src/libexpr/search-path.cc
+++ b/src/libexpr/search-path.cc
@@ -10,7 +10,7 @@ std::optional<std::string_view> SearchPath::Prefix::suffixIfPotentialMatch(
/* Non-empty prefix and suffix must be separated by a /, or the
prefix is not a valid path prefix. */
- bool needSeparator = n > 0 && (path.size() - n) > 0;
+ bool needSeparator = n > 0 && n < path.size();
if (needSeparator && path[n] != '/') {
return std::nullopt;