diff --git a/hal/common/mbed_error.c b/hal/common/mbed_error.c index 3b121934221..6fc72009a79 100644 --- a/hal/common/mbed_error.c +++ b/hal/common/mbed_error.c @@ -24,9 +24,11 @@ #endif WEAK void error(const char* format, ...) { +#ifndef NDEBUG va_list arg; va_start(arg, format); mbed_error_vfprintf(format, arg); va_end(arg); +#endif exit(1); }