Wouldn't it make sense to test first for value != null? That way you wouldn't compute that line all the time but only if necessary.