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

Fix QPointF IndexError: list index out of range #11393

Merged
merged 2 commits into from
Dec 27, 2023

Conversation

firmament2008
Copy link
Contributor

当QPointF 获取异常时,self.center 赋予默认值

PR 类型 PR types

Bug fixes

PR 变化内容类型 PR changes

Others

描述 Description

操作矩形绘制时,有机会导致异常退出。增加异常处理机制。

异常信息:
”PPOCRLabel\libs\shape.py", line 95, in close
self.center = QPointF((self.points[0].x() + self.points[2].x()) / 2,
IndexError: list index out of range

提PR之前的检查 Check-list

  • [ √ ] 这个 PR 是提交到dygraph分支或者是一个cherry-pick,否则请先提交到dygarph分支。
    This PR is pushed to the dygraph branch or cherry-picked from the dygraph branch. Otherwise, please push your changes to the dygraph branch.
  • [ √ ] 这个PR清楚描述了功能,帮助评审能提升效率。This PR have fully described what it does such that reviewers can speedup.
  • [ √ ] 这个PR已经经过本地测试。This PR can be convered by current tests or already test locally by you.

当QPointF 获取异常时,self.center  赋予默认值
Copy link

paddle-bot bot commented Dec 18, 2023

Thanks for your contribution!

Copy link
Collaborator

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个看上去只能避免处所,实际逻辑依旧不正确。
或者在except部分加上warning,说明center没有按照计算逻辑走,而是设置成了None。

@firmament2008
Copy link
Contributor Author

这个看上去只能避免处所,实际逻辑依旧不正确。 或者在except部分加上warning,说明center没有按照计算逻辑走,而是设置成了None。

已增加warning

Copy link
Collaborator

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@shiyutang shiyutang merged commit b5e5dba into PaddlePaddle:dygraph Dec 27, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants