[FOLLOWUP][BUGFIX] Check if `$rows` is an array before iteration