Update bh_platform.c

Add check for function bh_vprintf_sgx: check whether print_function is not NULL.
This commit is contained in:
wenyongh 2019-11-22 15:28:02 +08:00 committed by GitHub
parent 74374840fa
commit d16027ff9e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,8 +60,11 @@ int bh_printf_sgx(const char *message, ...)
int bh_vprintf_sgx(const char * format, va_list arg)
{
char msg[FIXED_BUFFER_SIZE] = { '\0' };
vsnprintf(msg, FIXED_BUFFER_SIZE, format, arg);
print_function(msg);
if (print_function != NULL) {
char msg[FIXED_BUFFER_SIZE] = { '\0' };
vsnprintf(msg, FIXED_BUFFER_SIZE, format, arg);
print_function(msg);
}
return 0;
}