Just to better understand this: why do we need the additional guard here? What would've been a valid execution (query object) that would've erroneously cause the exception before the fix?