Fix: Don't throw exception if git_hash is not set

This commit is contained in:
Thomas Basler 2024-03-12 22:11:19 +01:00
parent bd8d93bf92
commit 437f572c39

View File

@ -58,12 +58,16 @@ export default defineComponent({
})
},
getUpdateInfo() {
if (this.systemDataList.git_hash === undefined) {
return;
}
// If the left char is a "g" the value is the git hash (remove the "g")
this.systemDataList.git_is_hash = this.systemDataList.git_hash?.substring(0, 1) == 'g';
this.systemDataList.git_hash = this.systemDataList.git_is_hash ? this.systemDataList.git_hash?.substring(1) : this.systemDataList.git_hash;
// Handle format "v0.1-5-gabcdefh"
if (this.systemDataList.git_hash.lastIndexOf("-") >= 0) {
if (this.systemDataList.git_hash?.lastIndexOf("-") >= 0) {
this.systemDataList.git_hash = this.systemDataList.git_hash.substring(this.systemDataList.git_hash.lastIndexOf("-") + 2)
this.systemDataList.git_is_hash = true;
}