{"action":"created","issue":{"url":"https://api.github.com/repos/mabe02/lanterna/issues/155","labels_url":"https://api.github.com/repos/mabe02/lanterna/issues/155/labels{/name}","comments_url":"https://api.github.com/repos/mabe02/lanterna/issues/155/comments","events_url":"https://api.github.com/repos/mabe02/lanterna/issues/155/events","html_url":"https://github.com/mabe02/lanterna/issues/155","id":95423300,"number":155,"title":"Crash on using Panel.setContent from ActionDialog callback","user":{"login":"dant3","id":820057,"avatar_url":"https://avatars.githubusercontent.com/u/820057?v=3","gravatar_id":"","url":"https://api.github.com/users/dant3","html_url":"https://github.com/dant3","followers_url":"https://api.github.com/users/dant3/followers","following_url":"https://api.github.com/users/dant3/following{/other_user}","gists_url":"https://api.github.com/users/dant3/gists{/gist_id}","starred_url":"https://api.github.com/users/dant3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dant3/subscriptions","organizations_url":"https://api.github.com/users/dant3/orgs","repos_url":"https://api.github.com/users/dant3/repos","events_url":"https://api.github.com/users/dant3/events{/privacy}","received_events_url":"https://api.github.com/users/dant3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":24,"created_at":"2015-07-16T12:29:24Z","updated_at":"2015-07-18T12:34:24Z","closed_at":null,"body":"I'm trying to update my ui from ActionDialog callback. What I'm doing is:\r\n```scala\r\nval window = new BasicWindow()\r\nwindow.setComponent(createUi(None))\r\n// ...\r\nval dialog = new ActionDialogBuilder()\r\ndialog.addAction(device.name, toRunnable(() => window.setComponent(createUi(Some(device)))))\r\ndialog.build().showDialog(gui)\r\n// ...\r\ndef createUi(device):Panel = Panels.vertical(component1(device), componentWhichMightCallDialogAbove)\r\n//...\r\ndef toRunnable(fn: () => Unit):Runnable = new Runnable { override def run() = fn.apply() }\r\n```\r\n\r\nBut then this Runnable action get's called I'm getting exception:\r\n\r\n```\r\njava.lang.NullPointerException\r\n        at com.googlecode.lanterna.gui2.AbstractComponent.toBasePane(AbstractComponent.java:218)\r\n        at com.googlecode.lanterna.gui2.AbstractComponent.toBasePane(AbstractComponent.java:218)\r\n        at com.googlecode.lanterna.gui2.AbstractBasePane.getCursorPosition(AbstractBasePane.java:174)\r\n        at com.googlecode.lanterna.gui2.MultiWindowTextGUI.getCursorPosition(MultiWindowTextGUI.java:181)\r\n        at com.googlecode.lanterna.gui2.AbstractTextGUI.updateScreen(AbstractTextGUI.java:118)\r\n        at com.googlecode.lanterna.gui2.MultiWindowTextGUI.updateScreen(MultiWindowTextGUI.java:144)\r\n        at com.googlecode.lanterna.gui2.AbstractTextGUIThread.processEventsAndUpdate(AbstractTextGUIThread.java:61)\r\n        at com.googlecode.lanterna.gui2.MultiWindowTextGUI.waitForWindowToClose(MultiWindowTextGUI.java:275)\r\n        at com.googlecode.lanterna.gui2.AbstractWindow.waitUntilClosed(AbstractWindow.java:164)\r\n        at com.googlecode.lanterna.gui2.dialogs.DialogWindow.showDialog(DialogWindow.java:26)\r\n        at com.github.dant3.catlog.Main$.com$github$dant3$catlog$Main$$showDevicesList(Main.scala:58)\r\n        at com.github.dant3.catlog.Main$$anonfun$createToolbar$1.apply$mcV$sp(Main.scala:44)\r\n        at com.github.dant3.catlog.ui.Toolbar.com$github$dant3$catlog$ui$Toolbar$$handleKeyStroke(Toolbar.scala:20)\r\n        at com.github.dant3.catlog.ui.Toolbar$$anon$1.onUnhandledKeyStroke(Toolbar.scala:16)\r\n        at com.googlecode.lanterna.gui2.AbstractTextGUI.fireUnhandledKeyStroke(AbstractTextGUI.java:154)\r\n        at com.googlecode.lanterna.gui2.AbstractTextGUI.processInput(AbstractTextGUI.java:100)\r\n        at com.googlecode.lanterna.gui2.AbstractTextGUIThread.processEventsAndUpdate(AbstractTextGUIThread.java:53)\r\n        at com.googlecode.lanterna.gui2.MultiWindowTextGUI.waitForWindowToClose(MultiWindowTextGUI.java:275)\r\n        at com.googlecode.lanterna.gui2.AbstractWindow.waitUntilClosed(AbstractWindow.java:164)\r\n        at com.googlecode.lanterna.gui2.MultiWindowTextGUI.addWindowAndWait(MultiWindowTextGUI.java:252)\r\n        at com.github.dant3.catlog.Main$$anonfun$main$1.apply(Main.scala:19)\r\n        at com.github.dant3.catlog.Main$$anonfun$main$1.apply(Main.scala:17) \r\n        at com.github.dant3.catlog.ui.GUI$.run(GUI.scala:21)\r\n        at com.github.dant3.catlog.Main$.main(Main.scala:17)\r\n        at com.github.dant3.catlog.Main.main(Main.scala)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\r\n        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\r\n        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\r\n        at java.lang.reflect.Method.invoke(Method.java:497)\r\n```\r\n\r\nYou can find complete sources at https://github.com/dant3/catlog/blob/2725bfd14aeb5d1e371096ecd7fb46ee3c0d9c81/src/main/scala/com/github/dant3/catlog/Main.scala#L48"},"comment":{"url":"https://api.github.com/repos/mabe02/lanterna/issues/comments/122536893","html_url":"https://github.com/mabe02/lanterna/issues/155#issuecomment-122536893","issue_url":"https://api.github.com/repos/mabe02/lanterna/issues/155","id":122536893,"user":{"login":"mabe02","id":10136489,"avatar_url":"https://avatars.githubusercontent.com/u/10136489?v=3","gravatar_id":"","url":"https://api.github.com/users/mabe02","html_url":"https://github.com/mabe02","followers_url":"https://api.github.com/users/mabe02/followers","following_url":"https://api.github.com/users/mabe02/following{/other_user}","gists_url":"https://api.github.com/users/mabe02/gists{/gist_id}","starred_url":"https://api.github.com/users/mabe02/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mabe02/subscriptions","organizations_url":"https://api.github.com/users/mabe02/orgs","repos_url":"https://api.github.com/users/mabe02/repos","events_url":"https://api.github.com/users/mabe02/events{/privacy}","received_events_url":"https://api.github.com/users/mabe02/received_events","type":"User","site_admin":false},"created_at":"2015-07-18T12:34:23Z","updated_at":"2015-07-18T12:34:23Z","body":"Yes, we need that one too. I'll see if I can pull it in."}}