Quantcast
Channel: Ivanti User Community: Message List
Viewing all articles
Browse latest Browse all 12704

Re: Object reference not set to an instance of an object on a calculation

$
0
0

You really need some if test to make sure that _MigrateUser and the other items in the chain exists. You also need to return a value if the if test you do have fails. I've found that a bit of defense programming works wonders, so something like

 

if _MigrateUser != null and _MigrateUser._Show_ADUserDetails == true and _MigrateUser._Request != null and _MigrateUser._Request._Location != null:

return _MigrateUser._Request._Location.FullName

return null

 

A programming friend of mine used to look at my 'defenses' and say "Why would you want to do that - that should never happen as it is impossible" - but then people change the environment, have non-mandatory fields and so on, so best to be safe!


Viewing all articles
Browse latest Browse all 12704

Trending Articles