Modules can legitimately have a null item value. So don't catch null or '', only 0's (which would be an invalid item ID).