You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by rl...@apache.org on 2019/06/25 18:04:53 UTC
[celix] 02/03: Fixed crash in case service.version is missing
This is an automated email from the ASF dual-hosted git repository.
rlenferink pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/celix.git
commit a8a1da65bd85b20a18d27d3262fc985911f8fdca
Author: Roy Lenferink <le...@gmail.com>
AuthorDate: Tue Jun 25 15:08:43 2019 +0200
Fixed crash in case service.version is missing
---
libs/utils/src/version.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/libs/utils/src/version.c b/libs/utils/src/version.c
index cb2703d..48504c6 100644
--- a/libs/utils/src/version.c
+++ b/libs/utils/src/version.c
@@ -100,6 +100,11 @@ celix_status_t version_destroy(version_pt version) {
celix_status_t version_createVersionFromString(const char * versionStr, version_pt *version) {
celix_status_t status = CELIX_SUCCESS;
+ if (versionStr == NULL) {
+ *version = NULL;
+ return status;
+ }
+
int major = 0;
int minor = 0;
int micro = 0;
@@ -251,10 +256,8 @@ celix_status_t version_isCompatible(version_pt user, version_pt provider, bool*
bool result = false;
if (user == NULL || provider == NULL) {
- return CELIX_ILLEGAL_ARGUMENT;
- }
-
- if (user->major == provider->major) {
+ result = true; // When no version defined, always respond as compatible
+ } else if (user->major == provider->major) {
result = (provider->minor >= user->minor);
}