user2624407
user2624407

Reputation: 159

C# Bug? - System.NullReferenceException was unhandled by user code

I keep getting this error even tho the strings that i want to call to a function aren't null

enter image description here

(As you can see in pic the string isn't null)

This is the error

System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.

I even added some code to "handle", I mean to see if the strings are null, and they aren't but still it shows the error

if (opp1name != null && opp2name != null && opp3name != null)

This may be useful too?

enter image description here

Upvotes: 1

Views: 9571

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564403

This could also occur if pl is null, or if something required within the pl.Send method (aside from the passed arguments) is null.

Make sure to properly instantiate pl (so it is not null), as this is the most likely cause of the issue.

Upvotes: 12

Related Questions