Handle exceptions correctly inside getState()
Merge branch 'master' of https://github.com/peastman/openmm