From 070e0bf4f632447486d3361cd473066ba169f132 Mon Sep 17 00:00:00 2001 From: Ken Matsui <26405363+ken-matsui@users.noreply.github.com> Date: Mon, 1 Jan 2024 11:17:11 -0800 Subject: [PATCH] Fix prerelease comparison --- src/Semver.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Semver.cc b/src/Semver.cc index fcd489f68..963e299d4 100644 --- a/src/Semver.cc +++ b/src/Semver.cc @@ -100,6 +100,12 @@ bool operator!=(const Prerelease& lhs, const Prerelease& rhs) noexcept { return !(lhs == rhs); } bool operator<(const Prerelease& lhs, const Prerelease& rhs) noexcept { + if (lhs.ident.empty()) { + return false; // lhs is a normal version and is greater + } + if (rhs.ident.empty()) { + return true; // rhs is a normal version and is greater + } for (usize i = 0; i < lhs.ident.size() && i < rhs.ident.size(); ++i) { if (lhs.ident[i] < rhs.ident[i]) { return true;