diff --git a/pcsx2/CDVD/zlib_indexed.h b/pcsx2/CDVD/zlib_indexed.h index 1ae7238944..4fc9496b15 100644 --- a/pcsx2/CDVD/zlib_indexed.h +++ b/pcsx2/CDVD/zlib_indexed.h @@ -303,6 +303,11 @@ local int build_index(FILE *in, PX_off_t span, struct access **built) } } while (ret != Z_STREAM_END); + if (index == NULL) { + // Could happen if the start of the stream in Z_STREAM_END + return 0; + } + /* clean up and return index (release unused entries in list) */ (void)inflateEnd(&strm); index->list = (Point*)realloc(index->list, sizeof(struct point) * index->have); diff --git a/plugins/GSdx/GSRendererHW.cpp b/plugins/GSdx/GSRendererHW.cpp index 4efa2eb041..5eb7206b90 100644 --- a/plugins/GSdx/GSRendererHW.cpp +++ b/plugins/GSdx/GSRendererHW.cpp @@ -463,7 +463,8 @@ void GSRendererHW::Draw() { s = format("%05d_f%lld_rz0_%05x_%d.bmp", s_n, frame, context->ZBUF.Block(), context->ZBUF.PSM); - ds_tex->Save(root_hw+s); + if (ds_tex) + ds_tex->Save(root_hw+s); } s_n++;