Skip to content

Commit

Permalink
Checking for null pointer to resources location, as resources are opt…
Browse files Browse the repository at this point in the history
…ional.
  • Loading branch information
bandurvp committed Oct 26, 2017
1 parent 3730421 commit 991bc6b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/fmu-import-export/src/main/resources/c-templates/Fmu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 991bc6b

Please sign in to comment.