From 57faaf253afb5d6b59b53c2322e9ae42dc3633b4 Mon Sep 17 00:00:00 2001 From: Tajang <63721558+TajangSec@users.noreply.github.com> Date: Thu, 16 Nov 2023 09:34:37 +0800 Subject: [PATCH] Fix panic on GetPictureCells without drawing relationships parts (#1721) --- picture.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/picture.go b/picture.go index 499f493..9411f07 100644 --- a/picture.go +++ b/picture.go @@ -622,9 +622,10 @@ func (f *File) extractDecodeCellAnchor(anchor *xdrCellAnchor, drawingRelationshi _ = f.xmlNewDecoder(strings.NewReader("" + anchor.GraphicFrame + "")).Decode(&deCellAnchor) if deCellAnchor.From != nil && deCellAnchor.Pic != nil { if cond(deCellAnchor.From) { - drawRel = f.getDrawingRelationships(drawingRelationships, deCellAnchor.Pic.BlipFill.Blip.Embed) - if _, ok := supportedImageTypes[strings.ToLower(filepath.Ext(drawRel.Target))]; ok { - cb(deCellAnchor, drawRel) + if drawRel = f.getDrawingRelationships(drawingRelationships, deCellAnchor.Pic.BlipFill.Blip.Embed); drawRel != nil { + if _, ok := supportedImageTypes[strings.ToLower(filepath.Ext(drawRel.Target))]; ok { + cb(deCellAnchor, drawRel) + } } } }