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

[bug]: NPE when I click in preview layout without layout files opened #1176

Closed
2 tasks done
Rafael2616 opened this issue Aug 4, 2023 · 4 comments
Closed
2 tasks done
Labels
bug Something isn't working
Milestone

Comments

@Rafael2616
Copy link
Contributor

What happened?

I don't use the layout feature, but I've noticed that if I have a layout and close it and try to preview it, the app hangs at an NPE

Video showing the issue:

Screenshot_20230804_201753.2.mp4

What's the expected behavior?

No crash

What version of AndroidIDE you're using?

v2.5.0 (debug builds)

Relevant log output

AndroidIDE crash report
Manufacturer: LGE
Device: LM-X420
ABI: armeabi-v7a
SDK version: 28
App version: v2.5.1-beta.internal.1+branch.dev.commit.86fbed8.timestamp.20230803142331 (251)

 Stacktrace: 
java.lang.NullPointerException
	at com.itsaky.androidide.actions.etc.PreviewLayoutAction.execAction(PreviewLayoutAction.kt:93)
	at com.itsaky.androidide.actions.etc.PreviewLayoutAction.execAction(PreviewLayoutAction.kt:37)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry.executeAction$lambda$4(DefaultActionsRegistry.kt:180)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry.$r8$lambda$dXsASD5DI7x0X3S7AhqTqILaCV8(Unknown Source:0)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry$$ExternalSyntheticLambda0.run(Unknown Source:6)
	at com.blankj.utilcode.util.ThreadUtils.runOnUiThread(ThreadUtils.java:70)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry.executeAction(DefaultActionsRegistry.kt:179)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry.addActionToMenu$lambda$3(DefaultActionsRegistry.kt:169)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry.$r8$lambda$PPRxnA5HN5W60216J1ZeVbR5hrk(Unknown Source:0)
	at com.itsaky.androidide.actions.internal.DefaultActionsRegistry$$ExternalSyntheticLambda3.onMenuItemClick(Unknown Source:6)
	at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:155)
	at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:987)
	at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:977)
	at androidx.appcompat.widget.ActionMenuView.invokeItem(ActionMenuView.java:625)
	at androidx.appcompat.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:156)
	at android.view.View.performClick(View.java:6615)
	at android.view.View.performClickInternal(View.java:6587)
	at android.view.View.access$3500(View.java:784)
	at android.view.View$PerformClick.run(View.java:26050)
	at android.os.Handler.handleCallback(Handler.java:873)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:205)
	at android.app.ActivityThread.main(ActivityThread.java:6993)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:884)

Duplicate issues

  • This issue has not been reported yet.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Rafael2616 Rafael2616 added the bug Something isn't working label Aug 4, 2023
@itsaky
Copy link
Member

itsaky commented Aug 6, 2023

Most probably, the options menu is not being invalidated when a file is closed. I'll look into it.

FaSheep added a commit to FaSheep/AndroidIDE that referenced this issue Aug 31, 2023
FaSheep added a commit to FaSheep/AndroidIDE that referenced this issue Sep 1, 2023
FaSheep added a commit to FaSheep/AndroidIDE that referenced this issue Sep 1, 2023
@itsaky itsaky added this to the v2.6.0-beta milestone Sep 3, 2023
@Rafael2616
Copy link
Contributor Author

This can already be marked as done by commit #1251?

@itsaky
Copy link
Member

itsaky commented Sep 3, 2023

There is another thing to improve regarding this issue. The options menu is not invalidated if the file is unsaved and you try to close the file.

That means, the above fix only handles the case if the file is already saved and then closed.

@Rafael2616
Copy link
Contributor Author

Ok

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

No branches or pull requests

2 participants