Commit d32d6026 authored by Qiuhao Li's avatar Qiuhao Li Committed by Ignacio Casal Quinteiro
Browse files

tools: check whether converter->surface is NULL

Fixes #3
parent 6bf9be28
...@@ -210,14 +210,17 @@ static void ...@@ -210,14 +210,17 @@ static void
gxps_converter_print_converter_end_document (GXPSConverter *converter) gxps_converter_print_converter_end_document (GXPSConverter *converter)
{ {
GXPSPrintConverter *print_converter = GXPS_PRINT_CONVERTER (converter); GXPSPrintConverter *print_converter = GXPS_PRINT_CONVERTER (converter);
cairo_status_t status;
if (converter->surface) {
cairo_surface_finish (converter->surface); cairo_status_t status;
status = cairo_surface_status (converter->surface);
if (status) cairo_surface_finish (converter->surface);
g_printerr ("Cairo error: %s\n", cairo_status_to_string (status)); status = cairo_surface_status (converter->surface);
cairo_surface_destroy (converter->surface); if (status)
converter->surface = NULL; g_printerr ("Cairo error: %s\n", cairo_status_to_string (status));
cairo_surface_destroy (converter->surface);
converter->surface = NULL;
g_free (print_converter->filename); g_free (print_converter->filename);
print_converter->filename = NULL; print_converter->filename = NULL;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment