From fb660b928f051a16c32ab316f4e06c580e13ead7 Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Thu, 31 Oct 2024 17:20:01 -0400
Subject: [PATCH] about-dialog: only show the project versions if available

This is a workaround for an issue that occurs due to the way Linux
packaging is done, where the git repository is not available in the
build source at configure time, which is when the version files are
generated, so we prevent a "." from being displayed if the version
string is not available.

Gitlab: #1857
Change-Id: I2f6a281eb89ec0f977749d135da68fe5b7c9c2da
---
 src/app/mainview/components/AboutPopUp.qml | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/app/mainview/components/AboutPopUp.qml b/src/app/mainview/components/AboutPopUp.qml
index ca80cdb8b..e876a711a 100644
--- a/src/app/mainview/components/AboutPopUp.qml
+++ b/src/app/mainview/components/AboutPopUp.qml
@@ -104,8 +104,20 @@ BaseModalDialog {
                                 font.pixelSize: JamiTheme.textFontSize
                                 padding: 0
                                 readonly property bool isBeta: AppVersionManager.isCurrentVersionBeta()
-                                text: JamiStrings.buildID + ": " + UtilsAdapter.getBuildIDStr() + "\n" +
-                                      JamiStrings.version + ": " + (isBeta ? "(Beta) " : "") + UtilsAdapter.getVersionStr()
+                                text: {
+                                    // HACK: Only display the version string if it has been constructed properly.
+                                    // This is a workaround for an issue that occurs due to the way Linux
+                                    // packaging is done, where the git repository is not available in the
+                                    // build source at configure time, which is when the version files are
+                                    // generated, so we prevent a "." from being displayed if the version
+                                    // string is not available.
+                                    var contentStr = JamiStrings.buildID + ": " + UtilsAdapter.getBuildIDStr();
+                                    const versionStr = UtilsAdapter.getVersionStr()
+                                    if (versionStr.length > 1) {
+                                        contentStr += "\n" + JamiStrings.version + ": " + (isBeta ? "(Beta) " : "") + versionStr
+                                    }
+                                    return contentStr
+                                }
 
                                 selectByMouse: true
                                 readOnly: true
-- 
GitLab