Fix for infinite looping in pretty printer

This is the naïve fix mentioned for #373. It's probably not a good solution, but it does prevent the test runner from crashing out.