From the little code you provided, I must say I have absolutely no idea what you are trying to achieve. A more complex description of the context (what the script is supposed to do ingame) might help, but anyway in order to prevent any bugs you are supposed to make sure the widget you are interacting with is non-null, visible and has the required action and only then attempt to interact with it.
So if 219, 0, 1 are the ids of the widget you want to do
if (widgets.get(219, 0, 1) != null && widgets.get(219, 0, 1).isVisible() && widgets.get(219, 0, 1).hasAction("Continue"))
widgets.get(219, 0, 1).interact("Continue");