From fb175ec600c21b5ffd7e6dcf15f487ba95b7577a Mon Sep 17 00:00:00 2001 From: Juho Hiltunen Date: Fri, 30 Mar 2018 10:22:00 +0300 Subject: [PATCH] Print an error message if voice is not specified with --compile Prevents a segfault. --- src/espeak-ng.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/espeak-ng.c b/src/espeak-ng.c index b3d7028d..699695cb 100644 --- a/src/espeak-ng.c +++ b/src/espeak-ng.c @@ -441,10 +441,15 @@ int main(int argc, char **argv) break; case 0x101: // --compile-debug case 0x102: // --compile - strncpy0(voicename, optarg2, sizeof(voicename)); - flag_compile = c; - quiet = true; - break; + if (optarg2 != NULL) { + strncpy0(voicename, optarg2, sizeof(voicename)); + flag_compile = c; + quiet = true; + break; + } else { + fprintf(stderr, "Voice name not specified\n", optarg2); + exit(EXIT_FAILURE); + } case 0x103: // --punct option_punctuation = 1; if (optarg2 != NULL) {