Earlier check for null target item

To avoid having nested ifs, the check to see if target item is null
was included in the previous if.