Make profiling code a bit less fragile.

This assert was technically correct right now. But it's easy to get
wrong if you have exceptions being thrown.