提交 b7b29684 编写于 作者: B Behdad Esfahbod

[hb-view] Handle write_to_png errors

上级 c2cb98c8
...@@ -324,6 +324,8 @@ draw (void) ...@@ -324,6 +324,8 @@ draw (void)
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
cairo_status_t status;
parse_opts (argc, argv); parse_opts (argc, argv);
FT_Init_FreeType (&ft_library); FT_Init_FreeType (&ft_library);
...@@ -336,7 +338,12 @@ main (int argc, char **argv) ...@@ -336,7 +338,12 @@ main (int argc, char **argv)
draw (); draw ();
draw (); draw ();
cairo_surface_write_to_png (surface, out_file); status = cairo_surface_write_to_png (surface, out_file);
if (status != CAIRO_STATUS_SUCCESS) {
fprintf (stderr, "Failed to write output file `%s': %s\n",
out_file, cairo_status_to_string (status));
exit (1);
}
return 0; return 0;
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册