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

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):

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

1 Like

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

1 Like

Thank you very much! I solved this problem.