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

setLocalProvinceName 内蒙古自治区 会崩溃 #34

Open
sixforsix opened this issue Mar 3, 2019 · 1 comment
Open

setLocalProvinceName 内蒙古自治区 会崩溃 #34

sixforsix opened this issue Mar 3, 2019 · 1 comment

Comments

@sixforsix
Copy link

sixforsix commented Mar 3, 2019

我已确认所提问题在 FAQ.md 及 Issues 上没有。

问题描述:mPopupKeyboard.getKeyboardEngine().setLocalProvinceName("内蒙古自治区"); app直接崩溃了。
其他省份没这个问题

@asiontang
Copy link

当前省份=蒙的时候,provinces.size=12,而firstRow.size()=10,则会崩溃:

      java.lang.IndexOutOfBoundsException: Index: 10, Size: 10
   	at java.util.ArrayList.get(ArrayList.java:411)
        	at com.parkingwang.keyboard.engine.NeighborLayoutTransformer.transformLayout(NeighborLayoutTransformer.java:38)

修复方式我简单的修改了
for (int headIdx = 0; headIdx < provinces.size(); headIdx++)
改为
for (int headIdx = 0; headIdx < Math.min(provinces.size(), firstRow.size()); headIdx++)
即可解决此崩溃问题.

完整Commit: Fork/vehicle-keyboard-android@979c57d

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

No branches or pull requests

2 participants