Added invalid value checks to PhysicsBody property setters & item.SetTransform, checking for excessively large values

This commit is contained in:
Joonas Rikkonen
2018-07-22 17:50:29 +03:00
parent bd845488d7
commit 0728784b8b
2 changed files with 49 additions and 22 deletions
@@ -532,6 +532,20 @@ namespace Barotrauma
public void SetTransform(Vector2 simPosition, float rotation, bool findNewHull = true)
{
if (!MathUtils.IsValid(simPosition))
{
string errorMsg =
"Attempted to move the item " + Name +
" to an invalid position (" + simPosition + ")\n" + Environment.StackTrace;
DebugConsole.ThrowError(errorMsg);
GameAnalyticsManager.AddErrorEventOnce(
"Item.SetPosition:InvalidPosition" + ID,
GameAnalyticsSDK.Net.EGAErrorSeverity.Error,
errorMsg);
return;
}
if (body != null)
{
try