Skip to content

Commit

Permalink
Merge pull request #345 from amitdo/training-noasserts
Browse files Browse the repository at this point in the history
Replace asserts with tprintf() and exit(1)
  • Loading branch information
amitdo committed Jun 15, 2016
2 parents 86acff5 + c3a7fab commit 32d5ef6
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions training/text2image.cpp
Expand Up @@ -423,11 +423,20 @@ int main(int argc, char** argv) {
}
return EXIT_SUCCESS;
}

// Check validity of input flags.
ASSERT_HOST_MSG(!FLAGS_text.empty(), "Text file missing!\n");
ASSERT_HOST_MSG(!FLAGS_outputbase.empty(), "Output file missing!\n");
ASSERT_HOST_MSG(FLAGS_render_ngrams || FLAGS_unicharset_file.empty(),
"Use --unicharset_file only if --render_ngrams is set.\n");
if (FLAGS_text.empty()) {
tprintf("'--text' option is missing!\n");
exit(1);
}
if (FLAGS_outputbase.empty()) {
tprintf("'--outputbase' option is missing!\n");
exit(1);
}
if (!FLAGS_unicharset_file.empty() && FLAGS_render_ngrams) {
tprintf("Use '--unicharset_file' only if '--render_ngrams' is set.\n");
exit(1);
}

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

0 comments on commit 32d5ef6

Please sign in to comment.