Only test against value if it's not nil