From a9128bb48ebd619a80df086cf386864f9f62058c Mon Sep 17 00:00:00 2001 From: Jiaju Zhuang Date: Wed, 28 Aug 2019 09:36:34 +0800 Subject: [PATCH] fix #506 --- .../excel/write/metadata/holder/AbstractWriteHolder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java b/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java index e772837..c210f28 100644 --- a/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java +++ b/src/main/java/com/alibaba/excel/write/metadata/holder/AbstractWriteHolder.java @@ -23,6 +23,7 @@ import com.alibaba.excel.metadata.Head; import com.alibaba.excel.metadata.TableStyle; import com.alibaba.excel.metadata.property.ExcelContentProperty; import com.alibaba.excel.metadata.property.RowHeightProperty; +import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.write.handler.CellWriteHandler; import com.alibaba.excel.write.handler.DefaultWriteHandlerLoader; import com.alibaba.excel.write.handler.RowWriteHandler; @@ -267,7 +268,10 @@ public abstract class AbstractWriteHolder extends AbstractHolder implements Writ // add if (parentHandlerMap != null) { - handlerList.addAll(parentHandlerMap.get(WriteHandler.class)); + List parentWriteHandler = parentHandlerMap.get(WriteHandler.class); + if (!CollectionUtils.isEmpty(parentWriteHandler)) { + handlerList.addAll(parentWriteHandler); + } } // sort