Fixes NPE when null query is passed to AbstractDatabase#openQueryConnection.