guard against undefined code object in backtraces

I have no idea why this is necessary, but it seems to fix a lot of broken spectests