From 6683392a787fde4090646d10ea5f4a9fe2929a09 Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Mon, 5 Aug 2024 18:14:39 -0400 Subject: [PATCH] Fix a rare crash in DIAL server --- CHANGELOG.md | 1 + .../src/source/services/ApplicationInfo.bs | 34 ++++++++++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7693273b..79f023e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Few optimizations with texture loading to improve memory usage +- A rare crash in DIAL server ## [0.25.1] - 2024-08-03 diff --git a/playlet-lib/src/source/services/ApplicationInfo.bs b/playlet-lib/src/source/services/ApplicationInfo.bs index 846257cd..468233c1 100644 --- a/playlet-lib/src/source/services/ApplicationInfo.bs +++ b/playlet-lib/src/source/services/ApplicationInfo.bs @@ -87,18 +87,42 @@ class ApplicationInfo function GetLibVersion() as string values = m.GetLibManifestValues() + if values = invalid + return "0.0.0" + end if - Major = values["major_version"].toInt() - Minor = values["minor_version"].toInt() - Build = values["build_version"].toInt() + major = 0 + minor = 0 + build = 0 - return `${Major}.${Minor}.${Build}` + if values.DoesExist("major_version") + value = values["major_version"] + if IsString(value) + major = value.toInt() + end if + end if + + if values.DoesExist("minor_version") + value = values["minor_version"] + if IsString(value) + minor = value.toInt() + end if + end if + + if values.DoesExist("build_version") + value = values["build_version"] + if IsString(value) + build = value.toInt() + end if + end if + + return `${major}.${minor}.${build}` end function function GetLibGitCommitHash() as string values = m.GetLibManifestValues() - if values.doesexist("git_commit_sha") + if values.DoesExist("git_commit_sha") return values["git_commit_sha"] end if return ""