From: Thomas Perrot <[email protected]>
Both latest_versionstring() and latest_versionstring_from_index() would
raise IndexError on versions[-1] if the fetched index returns no usable
versions.
Return ("", "") in that case, consistent with what callers expect when
no upstream version can be determined.
Signed-off-by: Thomas Perrot <[email protected]>
---
lib/bb/fetch2/crate.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/bb/fetch2/crate.py b/lib/bb/fetch2/crate.py
index d84bae0bcd1e..eb1fd5719e8c 100644
--- a/lib/bb/fetch2/crate.py
+++ b/lib/bb/fetch2/crate.py
@@ -164,7 +164,7 @@ class Crate(Wget):
versions = [(0, i["num"], "") for i in json_data["versions"]]
versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
- return (versions[-1][1], "")
+ return (versions[-1][1], "") if versions else ("", "")
def latest_versionstring_from_index(self, ud, d):
"""
@@ -182,4 +182,4 @@ class Crate(Wget):
versions.append((0, data["vers"], ""))
versions = sorted(versions, key=cmp_to_key(bb.utils.vercmp))
- return (versions[-1][1], "")
+ return (versions[-1][1], "") if versions else ("", "")
--
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.