From: Christian Heller Date: Sat, 24 Aug 2013 04:09:54 +0000 (+0200) Subject: Added generic default error message to exit_err(). X-Git-Tag: tce~1062 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/process?a=commitdiff_plain;h=abc2583a1407593900033de8e9f4419e73cf9848;p=plomrogue Added generic default error message to exit_err(). --- diff --git a/src/rexit.c b/src/rexit.c index 73d740b..ee71809 100644 --- a/src/rexit.c +++ b/src/rexit.c @@ -67,6 +67,10 @@ extern void exit_err(uint8_t err, struct World * world, char * msg) return; } cleanup(world); + if (NULL == msg) + { + msg = "Some error encountered. Aborted."; + } printf("%s\n", msg); exit(EXIT_FAILURE); } diff --git a/src/rexit.h b/src/rexit.h index f020485..ac85577 100644 --- a/src/rexit.h +++ b/src/rexit.h @@ -35,9 +35,10 @@ extern void exit_game(struct World * world); -/* If "err" != 0, exit with an error message "msg" and clean up. (For "err", - * pass the result of functions that return non-zero as an error status and - * thereby avoid bloating up the code with if-error-conditionals.) +/* If "err" != 0, exit with an error message "msg" and clean up. If "msg" is a + * NULL pointer, return generic error message. (For "err", pass the result of + * functions that return non-zero as an error status and thereby avoid bloating + * up the code with if-error-conditionals.) */ extern void exit_err(uint8_t err, struct World * world, char * msg);