How to catch integer(0)?

Let's say we have a statement that produces integer(0), e.g. a <- which(1:3 == 5) What is the safest way of catching this?