I disagree. When a set expression includes Dxxx and the player does not have any copies of outfit xxx—including if there is not actually any such outfit as xxx in any data or plug-in file—that part of the expression is evaluated. The result of this evaluation is to check what outfits the player owns and, when the number of outfit xxx owned is found to be zero, no action is taken.
I claim this is different from simply not evaluating that part of the expression. In particular, the game does check what outfits the player owns, which updates the player's ship immediately. To check this, I altered the IR Missile outfit to have a substantial negative modification to turning rate. Then, after buying IR Missiles, my turning rate was extremely slow. After firing all the IR Missiles, my turning rate was still extremely slow (unchanged) because the game does not update the player's stats after firing a weapon.
But I also had a mission that created a derelict ship in the system, with the goal of destroying it. OnShip done I tried having it do nothing, having it abort itself, having it both abort itself and call D129 when I did not own any of outfit 129, and having it both abort itself and call D450 when not only did I not own any but outfit 450 did not exist in any plug-in or data file.
In the first two cases, when I killed the mission ship my turn rate stayed slow. In the latter two cases, when I killed the ship my turn rate immediately jumped back up to normal. Thus, calling Dxxx is sufficient to update the player's ship's stats in flight.
Further tests reveal that D99999, D32767, D640, and D127 do nothing, but D639 works. So if the xxx is outside the allowable range of outfits, then that part of the expression does not evaluate.