core/msg: prevent null pointer dereference

- [x] needs checking for new return value compatibility
- [x] `printf` needs removing
This block could be moved to the very start of the function. Just check `target_pid == sched_active_pid`.