79447996

Date: 2025-02-18 11:02:32
Score: 1
Natty:
Report link

Check the object is null or enclose with try and catch

sol1: if(mainObject && mainObject.yourObject != null { /** add what yuo what you want to handle*/ }

Sol2: try{obj = mainObject.yourObject;}catch(Exception e){/** fallback code*/}

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Harry