--- a/poppler/CairoOutputDev.cc +++ b/poppler/CairoOutputDev.cc @@ -1050,21 +1050,23 @@ void CairoOutputDev::eoClip(GfxState *state) { void CairoOutputDev::clipToStrokePath(GfxState *state) { LOG(printf("clip-to-stroke-path\n")); - strokePathClip = (StrokePathClip*)gmalloc (sizeof(*strokePathClip)); - doPath (cairo, state, state->getPath()); - strokePathClip->path = cairo_copy_path (cairo); - cairo_get_matrix (cairo, &strokePathClip->ctm); - strokePathClip->line_width = cairo_get_line_width (cairo); - strokePathClip->dash_count = cairo_get_dash_count (cairo); - if (strokePathClip->dash_count) { - strokePathClip->dashes = (double*) gmallocn (sizeof(double), strokePathClip->dash_count); - cairo_get_dash (cairo, strokePathClip->dashes, &strokePathClip->dash_offset); - } else { - strokePathClip->dashes = NULL; + if (cairo) { + strokePathClip = (StrokePathClip*)gmalloc (sizeof(*strokePathClip)); + doPath (cairo, state, state->getPath()); + strokePathClip->path = cairo_copy_path (cairo); + cairo_get_matrix (cairo, &strokePathClip->ctm); + strokePathClip->line_width = cairo_get_line_width (cairo); + strokePathClip->dash_count = cairo_get_dash_count (cairo); + if (strokePathClip->dash_count) { + strokePathClip->dashes = (double*) gmallocn (sizeof(double), strokePathClip->dash_count); + cairo_get_dash (cairo, strokePathClip->dashes, &strokePathClip->dash_offset); + } else { + strokePathClip->dashes = NULL; + } + strokePathClip->cap = cairo_get_line_cap (cairo); + strokePathClip->join = cairo_get_line_join (cairo); + strokePathClip->miter = cairo_get_miter_limit (cairo); } - strokePathClip->cap = cairo_get_line_cap (cairo); - strokePathClip->join = cairo_get_line_join (cairo); - strokePathClip->miter = cairo_get_miter_limit (cairo); } void CairoOutputDev::fillToStrokePathClip() {