kotcrab/vis-ui

IllegalArgumentException application crash when typing name in FileChooser "Open" dialog

MarcinSc opened this issue · 2 comments

I opened a FileChooser in OPEN mode, and when pressed a random key ("b" in this case), and there were no files starting with that name, I got this - which crashed the application.

Exception in thread "LWJGL Application" java.lang.RuntimeException: Actor: b
	at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:192)
	at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:152)
	at com.badlogic.gdx.scenes.scene2d.Stage.keyTyped(Stage.java:446)
	at com.badlogic.gdx.InputEventQueue.drain(InputEventQueue.java:64)
	at com.badlogic.gdx.backends.lwjgl.DefaultLwjglInput.processEvents(DefaultLwjglInput.java:255)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:220)
	at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:127)
Caused by: java.lang.RuntimeException: Actor: b
	at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:192)
	at com.badlogic.gdx.scenes.scene2d.Actor.fire(Actor.java:152)
	at com.kotcrab.vis.ui.widget.VisTextField.changeText(VisTextField.java:702)
	at com.kotcrab.vis.ui.widget.VisTextField$TextFieldClickListener.keyTyped(VisTextField.java:1232)
	at com.badlogic.gdx.scenes.scene2d.InputListener.handle(InputListener.java:57)
	at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:188)
	... 6 more
Caused by: java.lang.IllegalArgumentException: actor cannot be null.
	at com.badlogic.gdx.scenes.scene2d.ui.Table.getCell(Table.java:417)
	at com.kotcrab.vis.ui.widget.MenuItem.getImageCell(MenuItem.java:352)
	at com.kotcrab.vis.ui.widget.file.internal.AbstractSuggestionPopup.createMenuItem(AbstractSuggestionPopup.java:36)
	at com.kotcrab.vis.ui.widget.file.internal.FileSuggestionPopup.createSuggestions(FileSuggestionPopup.java:55)
	at com.kotcrab.vis.ui.widget.file.internal.FileSuggestionPopup.pathFieldKeyTyped(FileSuggestionPopup.java:41)
	at com.kotcrab.vis.ui.widget.file.FileChooser$16.changed(FileChooser.java:558)
	at com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.handle(ChangeListener.java:28)
	at com.badlogic.gdx.scenes.scene2d.Actor.notify(Actor.java:188)
	... 11 more

Here is how I created the FileChooser:

FileChooser fileChooser = new FileChooser(FileChooser.Mode.OPEN);
fileChooser.setModal(true);
fileChooser.setSelectionMode(FileChooser.SelectionMode.FILES);
fileChooser.setListener(new FileChooserAdapter() {
  @Override
  public void selected(Array<FileHandle> file) {
                    // Listener code here
  }
});
getStage().addActor(fileChooser.fadeIn());

It looks like this was fixed in the latest commit -- maybe there's a nightly or snapshot build that you can test?

@tommyettinger Yes, that fixed the problem. Thanks!