0

When I run the app the rest of the search bar is working properly, however, when I press the cancel button on the search bar it crashes the program with the error

{System.NullReferenceException: Object reference not set to an instance of an object
    at App.SearchPage+<>c__DisplayClass4_0.<SearchBar_TextChanged>b__0 (System.String Name) [0x00000] in /Users}

This problem is only happening on the IOS app since the Android app does not include the cancel button.

Laurenz Albe
  • 129,316
  • 15
  • 96
  • 132
  • 3
    please show the relevant code. Does the stack trace show the origin of the exception? – Jason May 09 '20 at 23:24
  • 1
    May when you are watching TextChanged event it is firing the event with null text, add null check in your code. – Akash Kava May 10 '20 at 04:20
  • I was able to figure it out. The problem was that when i pressed the cancel it was giving a null which i did not have a check for. Thanks Akash – Sneh Patel May 11 '20 at 03:45
  • Does this answer your question? [What is a NullReferenceException, and how do I fix it?](https://stackoverflow.com/questions/4660142/what-is-a-nullreferenceexception-and-how-do-i-fix-it) – Joe Mayo May 11 '20 at 16:21

0 Answers0