Fix: Handle null pointer errors using if-else statements
Addressed potential null pointer errors in the code with if-else blocks.
Added explicit checks to ensure objects are not null before performing operations, enhancing the code's
robustness and preventing unexpected null pointer exceptions.
Fix: Handle null pointer errors using if-else statements