Blob Blame Raw
From 9e9df4b20d17478996780008bc9802a857d173fc Mon Sep 17 00:00:00 2001
From: Albert Astals Cid <aacid@kde.org>
Date: Thu, 8 Jan 2015 17:01:52 +0100
Subject: Fix crash on broken document

Bug #85281

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 359c0d6..b439942 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -16,7 +16,7 @@
 // Copyright (C) 2005 Kristian Høgsberg <krh@redhat.com>
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff@infidigm.net>
 // Copyright (C) 2006, 2010 Carlos Garcia Campos <carlosgc@gnome.org>
-// Copyright (C) 2006-2014 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2006-2015 Albert Astals Cid <aacid@kde.org>
 // Copyright (C) 2009, 2012 Koji Otani <sho@bbr.jp>
 // Copyright (C) 2009, 2011-2013 Thomas Freitag <Thomas.Freitag@alfa.de>
 // Copyright (C) 2009 Christian Persch <chpe@gnome.org>
@@ -3048,8 +3048,12 @@ GfxColorSpace *GfxDeviceNColorSpace::copy() {
   int *mappingA = NULL;
 
   GooList *sepsCSA = new GooList(sepsCS->getLength());
-  for (i = 0; i < sepsCS->getLength(); i++)
-    sepsCSA->append(((GfxSeparationColorSpace *) sepsCS->get(i))->copy());
+  for (i = 0; i < sepsCS->getLength(); i++) {
+    GfxSeparationColorSpace *scs = (GfxSeparationColorSpace *) sepsCS->get(i);
+    if (scs != NULL) {
+      sepsCSA->append(scs->copy());
+    }
+  }
   if (mapping != NULL) {
     mappingA = (int *)gmalloc(sizeof(int) * nComps);
     for (i = 0; i < nComps; i++)
-- 
cgit v0.10.2