Prevent NullPointerException in ProposalsView

When activating the ProposalsView, the table height is updated on the
user thread. Sometimes the scene is unavailable and causes a
NullPointerException. This should at least prevent the exception.

Fixes #2883 and #3116
This commit is contained in:
Devin Bileck 2019-08-21 00:59:30 -07:00
parent f2f62c7033
commit b095086204
No known key found for this signature in database
GPG key ID: C86D829C2399D073

View file

@ -209,7 +209,10 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
tableView.setPrefHeight(100);
root.getScene().heightProperty().addListener(sceneHeightListener);
UserThread.execute(() -> updateTableHeight(root.getScene().getHeight()));
UserThread.execute(() -> {
if (root.getScene() != null)
updateTableHeight(root.getScene().getHeight());
});
stakeInputTextField.textProperty().addListener(stakeListener);
voteButton.setOnAction(e -> onVote());