Explicitly check for None to accept 0 as a valid value.

Closes-Bug: 1369812
(cherry picked from commit b10c27f382cafcb166af3db347b386ed50b348e1)

Change-Id: I9e4a156201b40611cffe69c0a24247311f0d90f9