Skip to content

Commit 32d5ef6

Browse files
authored
Merge pull request #345 from amitdo/training-noasserts
Replace asserts with tprintf() and exit(1)
2 parents 86acff5 + c3a7fab commit 32d5ef6

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

training/text2image.cpp

+13-4
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,20 @@ int main(int argc, char** argv) {
423423
}
424424
return EXIT_SUCCESS;
425425
}
426+
426427
// Check validity of input flags.
427-
ASSERT_HOST_MSG(!FLAGS_text.empty(), "Text file missing!\n");
428-
ASSERT_HOST_MSG(!FLAGS_outputbase.empty(), "Output file missing!\n");
429-
ASSERT_HOST_MSG(FLAGS_render_ngrams || FLAGS_unicharset_file.empty(),
430-
"Use --unicharset_file only if --render_ngrams is set.\n");
428+
if (FLAGS_text.empty()) {
429+
tprintf("'--text' option is missing!\n");
430+
exit(1);
431+
}
432+
if (FLAGS_outputbase.empty()) {
433+
tprintf("'--outputbase' option is missing!\n");
434+
exit(1);
435+
}
436+
if (!FLAGS_unicharset_file.empty() && FLAGS_render_ngrams) {
437+
tprintf("Use '--unicharset_file' only if '--render_ngrams' is set.\n");
438+
exit(1);
439+
}
431440

432441
if (!FLAGS_find_fonts && !FontUtils::IsAvailableFont(FLAGS_font.c_str())) {
433442
string pango_name;

0 commit comments

Comments
 (0)