Nios II can't catch NULL pointer dereferences because that requires a memory management or memory protection unit. On the x86 processor the CPU catches the NULL pointer dereference and the OS tells the runtime library to throw the exception.
If you use hardware divide then the Nios II CPU won't trap divide by 0 so you have to write your code as specified. If you use software divide then an easier solution is possible since the compiler calls functions like __divsi3 to do the division.
You can create your own __divsi3 file, by copying the standard version of nios2-gnutools/src/gcc/gcc/config/nios2/lib2-divmod.c to your system library project and modifying it to throw the exception if appropriate.