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

🔨 修复 getRelativeRowIndex 转换int 可能会导致的空指针异常 #3616

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marchocode
Copy link

在开发中发现此 AbstractRowHeightStyleStrategy 类中,context.getRelativeRowIndex() 调用会产生 null 值。而同类的两个抽象方法都是使用int 作为接收参数,转换过程中会存在空指针的异常出现。

同时 默认实现的 SimpleRowHeightStyleStrategy 也应该使用 Integer 作为参数接收。

PR修复了以上问题。

    @Override
    public void afterRowDispose(RowWriteHandlerContext context) {
        if (context.getHead() == null) {
            return;
        }
        if (context.getHead()) {
            setHeadColumnHeight(context.getRow(), context.getRelativeRowIndex());
        } else {
            setContentColumnHeight(context.getRow(), context.getRelativeRowIndex());
        }
    }

    protected abstract void setHeadColumnHeight(Row row, int relativeRowIndex);

    protected abstract void setContentColumnHeight(Row row, int relativeRowIndex);

@CLAassistant
Copy link

CLAassistant commented Dec 20, 2023

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants