RS2Widget myWid = widgets.get(219, 1, 1);
You are referring to this line right? Its ok to do because I am assigning an Object reference here. An object reference is just like a regular variable assignment (ex: int myint = 1;) except it deals with a class (ex: Rs2Widget, ArrayList, String) instead of a primitive (int, double, boolean). Remember, in Java an object reference can be assigned to null.
Assuming the widgets.get() returns null, a null pointer will only occur if I attempt to do something with it without null checking, (Such as myWid.isVisible()). Thats why I still have your original null check just modified to use myWid.
if(myWid != null && myWid.isVisible())
Watch this video to get a more indepth explanation of primitives vs references.