diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-21 00:35:30 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2020-04-21 00:35:30 -0400 |
commit | caac5ec33f28a84744c7278f1e31dbfb8b8148d0 (patch) | |
tree | e69df7ce2108a462a401b7638c3ec0097a140f44 /lib | |
parent | 110489259c0696c0cee5bec6ad7695a0c93d4e74 (diff) | |
download | spmc-caac5ec33f28a84744c7278f1e31dbfb8b8148d0.tar.gz |
Handle NULL reason
Diffstat (limited to 'lib')
-rw-r--r-- | lib/error_handler.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/error_handler.c b/lib/error_handler.c index 4e06919..cb2ef51 100644 --- a/lib/error_handler.c +++ b/lib/error_handler.c @@ -16,13 +16,19 @@ const char *SPM_ERR_STRING[] = { NULL, }; +/** + * Append error text to an existing spmerrno error string + * @param reason message text + */ void spmerrno_cause(const char *reason) { char *buf = spmerrbuf_reason; - sprintf(buf, " (%s)", reason); - return; + if (reason != NULL) { + sprintf(buf, " (%s)", reason); + } } + /** - * + * Translate a spmerrno code to an error string * @param code * @return */ |