Addresses #1660.

I'm not sure exactly how this happens, but this should stop the error from causing a crash.