You could do this conversion directly in your DB-query, thus avoiding the special case alltogether.
But I wouldn't call that 'cleaner', unless you can consistently use that form in your code, since you would lose information by returning '0' instead of NULL from the DB.