Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

excel写的时候,如果没有设置表头,会出现一个空指针异常 #806

Closed
anyueStarrysky opened this issue Nov 7, 2019 · 1 comment
Assignees
Labels
bug Something isn't working pending verification This problem needs to be confirmed

Comments

@anyueStarrysky
Copy link

触发场景描述
不设置表头
触发Bug的代码

当不设置表头时,这里的boolean needSetWidth = relativeRowIndex != null && (isHead || 
 relativeRowIndex == 0);判断为true会执行
    Integer width = columnWidth(head);
   当入参head为null时,执行AbstractWriteHolder类中的
new AbstractHeadColumnWidthStyleStrategy() {
                protected Integer columnWidth(Head head) {
                    return columnWidthMap.containsKey(head.getColumnIndex()) ? (Integer)columnWidthMap.get(head.getColumnIndex()) / 256 : 20;
                } 时,会出现空指针异常。

提示的异常或者没有达到的效果

@anyueStarrysky anyueStarrysky added the bug Something isn't working label Nov 7, 2019
@zhuangjiaju zhuangjiaju added the pending verification This problem needs to be confirmed label Nov 7, 2019
@zhuangjiaju
Copy link
Collaborator

这个字段可能为空 。2.1.3新增了一个 columnIndex 这个肯定不为空

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending verification This problem needs to be confirmed
Projects
None yet
Development

No branches or pull requests

2 participants