summaryrefslogtreecommitdiff
path: root/drawing.go
diff options
context:
space:
mode:
Diffstat (limited to 'drawing.go')
-rw-r--r--drawing.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/drawing.go b/drawing.go
index 181bb43..86d5ca6 100644
--- a/drawing.go
+++ b/drawing.go
@@ -1173,8 +1173,13 @@ func (f *File) drawingParser(path string) (*xlsxWsDr, int) {
}
f.Drawings.Store(path, &content)
}
- wsDr, _ := f.Drawings.Load(path)
- return wsDr.(*xlsxWsDr), len(wsDr.(*xlsxWsDr).OneCellAnchor) + len(wsDr.(*xlsxWsDr).TwoCellAnchor) + 2
+ var wsDr *xlsxWsDr
+ if drawing, ok := f.Drawings.Load(path); ok && drawing != nil {
+ wsDr = drawing.(*xlsxWsDr)
+ }
+ wsDr.Lock()
+ defer wsDr.Unlock()
+ return wsDr, len(wsDr.OneCellAnchor) + len(wsDr.TwoCellAnchor) + 2
}
// addDrawingChart provides a function to add chart graphic frame by given