Catch potential NPE and use specified "type" (when used to represent a
query parameter/variable)