You probably shouldn't attempt to do the rotation at all when you know the current and intended direction are the same (that is, there is no rotation) -- you might need to detect this occurrence at a higher level where you can skip the quaternion rotation, though.

An alternative, like I said before, is to use the same arbitrary perpendicular vector from the second case as I described before -- its already perpendicular so you don't need to do the cross product at all in either of these special cases. But you'll at least have a non-zero vector for the axis of rotation, and rotating by 0 degrees will leave the object unchanged, which I think is what you want. This way may be easier than detecting a 0-degree rotation and skipping it where the quaternion is applied.

If you don't need to support rotations of greater than 360 degrees (e.g. where 540 degrees is 1.5 turns) then in the case that the current and intended direction are identical (but not opposite) you can actually choose any vector at all to "rotate" around, because you rotate by 0 degrees anyhow, and the result is the same for any vector (modulo potential floating point error, I suppose, but should be too small to notice).