Exception: "Object reference not set to an instance of an object."

studio

#1

Hi, I’m an Executor of UiPath RPA Academy. I’ve got a problem as the blow.

If condition : mail.Sender.Address.Contains(row(“Sender”).toString)

Thrown an exception: “Object reference not set to an instance of an object.”

Please check the attachment.
“mailRules” DataTable is from Excel file.

How to solve this problem?

Scenario:

Steps to reproduce:

Current Behavior:

Expected Behavior:

Studio/Robot/Orchestrator Version:

Last stable behavior:
Last stable version:
OS Version:
Others if Relevant: (workflow, logs, .net version, service pack, etc):


#2

Hi,
Use this in if condition.
mail.From.Address.Contains(row(“Sender”).toString)


#3

You may face this issue if row(“Sender”) is null so to handle this you can try

mail.From.Address.Contains((row(“Sender”)!=null? row(“Sender”).toString():"")

Thanks,
Yuga


#4

Thank you very much! I solved this problem.