Replaced assert with msg->error for better error handling.

Signed-off-by: matematik7 <domen.ipavec@z-v.si>