From 991bc6b4e4a4cfcabab3f33a0d3f5c85158563be Mon Sep 17 00:00:00 2001 From: Victor Bandur Date: Thu, 26 Oct 2017 13:14:48 +0200 Subject: [PATCH] Checking for null pointer to resources location, as resources are optional. --- .../src/main/resources/c-templates/Fmu.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/fmu-import-export/src/main/resources/c-templates/Fmu.c b/core/fmu-import-export/src/main/resources/c-templates/Fmu.c index 85fef30..8143d3f 100644 --- a/core/fmu-import-export/src/main/resources/c-templates/Fmu.c +++ b/core/fmu-import-export/src/main/resources/c-templates/Fmu.c @@ -42,9 +42,11 @@ fmi2Component fmi2Instantiate(fmi2String instanceName, fmi2Type fmuType, fmi2Str strcpy(tmpInstanceName, instanceName); g_fmiInstanceName = tmpInstanceName; - resourcesLocation = (char*)calloc(strlen(fmuResourceLocation) + 1, sizeof(char)); - strcpy(resourcesLocation, fmuResourceLocation); - + if(fmuResourceLocation != NULL) + { + resourcesLocation = (char*)calloc(strlen(fmuResourceLocation) + 1, sizeof(char)); + strcpy(resourcesLocation, fmuResourceLocation); + } systemInit(); return (void*) 1;