question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`ScreenEvents.afterRender`'s screen null check fails when opening the disconnect screen

See original GitHub issue

Running the following in my screen’s render method results in the null check failing, and crashing the game.

client.getInstance().world.disconnect();
client.getInstance().disconnect(new SaveLevelScreen(new TranslatableText("menu.savingLevel")));

My screen’s code and the code that calls it Crash Log

Though, if I strip everything and just have the code in the code block in the render, and nothing else, it still crashes. If I run the code instead of opening the screen, it doesn’t crash.

The code in the quit method is practically identical to the code in the vanilla’s exit to main menu button

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
liachcommented, Feb 4, 2021

Like use an atomic boolean that is set to true in render method when the screen needs to quit. In tick method you detect if the boolean is true and quit accordingly if it is.

0reactions
apple502jcommented, Jul 2, 2022

The check should never occur except in cases of race condition in 1.17+.

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase - _CastError (Null check operator used on a null ...
So I am creating an Instagram clone and when I open the feed screen, an error that says '_CastError (Null check operator used...
Read more >
Automatic Output Handling and Null Checking - UnofficialSF
Instead, the Flow team recommends using Automatic Output Handling and checking whether the object itself is null instead of checking its fields.
Read more >
Getting errors with null fields - Power Automate | Microsoft Learn
Provides a solution to an error that occurs when you create a flow in Microsoft Power Automate.
Read more >
Understanding Null-Safety in Flutter with Real-world example
First create a screen to show the data. Let's create a class HomeScreen which can look like class HomeScreen extends StatefulWidget { const ......
Read more >
Non-Nullable Dart: Understanding Null Safety - Kodeco
null helps developers deal with the unknown in their code. When any exception is not handled, the app will show a red error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found