Not sure, if this is just ported from 2.72, 3.0 but it exists on 3.1.2, if you set game.top_inv_item value less than 0 by accident game crashes, and a red x appears, saying it has created a crash dump file. Perhaps the function is now considered obsolete, so really sorry to bug you with this. If you care, i have the dmp file, and it's no trouble of sharing.
Yeah, game.top_inv_item is obsolete now, one of the reasons it is obsolete is because it isn't properly checked. Therefore, it is no longer supported.