Hi Guys,
When we get the list value has "null" in the contract class the process get stopped here and throwing the error as "object reference not set to an instance of an object"
code -
If (contract.parmlistId().elements())
Please help me to solve this.
Hi jenifer,
To check whether list is null or not you can use empty method and then get the elements.
if(!contract.parmListId().empty())
Thanks,
Girish S.
Hi Jennifer, This generic error occurs whenever there is null value in the object. Please provide more info on your code or debug your code where you are initializing ListId.
Also, check if contract is not null.
Hi jenifer,
The error means that you are referring to an object the does not exist or was deleted or cleaned up. It's usually better to avoid a NullReferenceException than to handle it after it occurs. To prevent the error, objects that could be null should be tested for null before being used.
if (mClass != null) { // Go ahead and use mClass mClass.property = ... } else { // Attempting to use mClass here will result in NullReferenceException }
whenever the list is empty this validation is getting failed
Abhilash Warrier
565
Martin Dráb
536
Most Valuable Professional
André Arnaud de Cal...
402
Super User 2025 Season 1