Fix #599: Make anonymous function optimization fail rather than crash
Merge pull request #615 from gzm0/safe-try-gen-anon

Fix #599: Make anonymous function optimization fail rather than crash