Avoid ArrayIndexOutOfBoundsException when result has no entries