fix segfault when onload and onerror are not function
Merge pull request #379 from Costent/master

fix segfault when Image::onload and Image::onerror are not function