From fc1a8e022b36e6275e1f7f1c97b37338cf3cbc57 Mon Sep 17 00:00:00 2001 From: Neil White Date: Tue, 24 Sep 2013 15:34:39 +0100 Subject: [PATCH] Fix for setting Matrix/Vector values by Index Many Matrix*/Vector* implementations were throwing IndexOutOfBoundsException when you tried to set their values via their indexer due to a missing else statement. --- Source/OpenTK/Math/Matrix2.cs | 2 +- Source/OpenTK/Math/Matrix2d.cs | 2 +- Source/OpenTK/Math/Matrix2x3.cs | 2 +- Source/OpenTK/Math/Matrix2x3d.cs | 2 +- Source/OpenTK/Math/Matrix2x4.cs | 2 +- Source/OpenTK/Math/Matrix2x4d.cs | 2 +- Source/OpenTK/Math/Matrix3.cs | 2 +- Source/OpenTK/Math/Matrix3d.cs | 2 +- Source/OpenTK/Math/Matrix3x2.cs | 2 +- Source/OpenTK/Math/Matrix3x2d.cs | 2 +- Source/OpenTK/Math/Matrix3x4.cs | 2 +- Source/OpenTK/Math/Matrix3x4d.cs | 2 +- Source/OpenTK/Math/Matrix4.cs | 2 +- Source/OpenTK/Math/Matrix4d.cs | 2 +- Source/OpenTK/Math/Matrix4x2.cs | 2 +- Source/OpenTK/Math/Matrix4x2d.cs | 2 +- Source/OpenTK/Math/Matrix4x3.cs | 2 +- Source/OpenTK/Math/Matrix4x3d.cs | 2 +- Source/OpenTK/Math/Vector2.cs | 2 +- Source/OpenTK/Math/Vector2d.cs | 2 +- Source/OpenTK/Math/Vector3.cs | 2 +- Source/OpenTK/Math/Vector3d.cs | 2 +- Source/OpenTK/Math/Vector4.cs | 2 +- Source/OpenTK/Math/Vector4d.cs | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Source/OpenTK/Math/Matrix2.cs b/Source/OpenTK/Math/Matrix2.cs index 45c16159..0a0cb382 100644 --- a/Source/OpenTK/Math/Matrix2.cs +++ b/Source/OpenTK/Math/Matrix2.cs @@ -182,7 +182,7 @@ namespace OpenTK { if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix2d.cs b/Source/OpenTK/Math/Matrix2d.cs index 82132a19..999f105e 100644 --- a/Source/OpenTK/Math/Matrix2d.cs +++ b/Source/OpenTK/Math/Matrix2d.cs @@ -182,7 +182,7 @@ namespace OpenTK { if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix2x3.cs b/Source/OpenTK/Math/Matrix2x3.cs index ecad5483..bd2236ca 100644 --- a/Source/OpenTK/Math/Matrix2x3.cs +++ b/Source/OpenTK/Math/Matrix2x3.cs @@ -184,7 +184,7 @@ namespace OpenTK { if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix2x3d.cs b/Source/OpenTK/Math/Matrix2x3d.cs index 454f015d..30a59eb5 100644 --- a/Source/OpenTK/Math/Matrix2x3d.cs +++ b/Source/OpenTK/Math/Matrix2x3d.cs @@ -184,7 +184,7 @@ namespace OpenTK { if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix2x4.cs b/Source/OpenTK/Math/Matrix2x4.cs index c0c3579f..c3afecdb 100644 --- a/Source/OpenTK/Math/Matrix2x4.cs +++ b/Source/OpenTK/Math/Matrix2x4.cs @@ -205,7 +205,7 @@ namespace OpenTK { if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix2x4d.cs b/Source/OpenTK/Math/Matrix2x4d.cs index 48c42108..deb2b1cb 100644 --- a/Source/OpenTK/Math/Matrix2x4d.cs +++ b/Source/OpenTK/Math/Matrix2x4d.cs @@ -205,7 +205,7 @@ namespace OpenTK { if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix3.cs b/Source/OpenTK/Math/Matrix3.cs index 89711569..cd2f3bc7 100644 --- a/Source/OpenTK/Math/Matrix3.cs +++ b/Source/OpenTK/Math/Matrix3.cs @@ -245,7 +245,7 @@ namespace OpenTK if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix3d.cs b/Source/OpenTK/Math/Matrix3d.cs index 39883f63..13799649 100644 --- a/Source/OpenTK/Math/Matrix3d.cs +++ b/Source/OpenTK/Math/Matrix3d.cs @@ -241,7 +241,7 @@ namespace OpenTK if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix3x2.cs b/Source/OpenTK/Math/Matrix3x2.cs index 452e517e..639f093a 100644 --- a/Source/OpenTK/Math/Matrix3x2.cs +++ b/Source/OpenTK/Math/Matrix3x2.cs @@ -186,7 +186,7 @@ namespace OpenTK if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix3x2d.cs b/Source/OpenTK/Math/Matrix3x2d.cs index a8958ab4..8f1804e9 100644 --- a/Source/OpenTK/Math/Matrix3x2d.cs +++ b/Source/OpenTK/Math/Matrix3x2d.cs @@ -186,7 +186,7 @@ namespace OpenTK if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix3x4.cs b/Source/OpenTK/Math/Matrix3x4.cs index ae07dc68..7d251d57 100644 --- a/Source/OpenTK/Math/Matrix3x4.cs +++ b/Source/OpenTK/Math/Matrix3x4.cs @@ -239,7 +239,7 @@ namespace OpenTK if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix3x4d.cs b/Source/OpenTK/Math/Matrix3x4d.cs index a6d32aff..fa37cfc8 100644 --- a/Source/OpenTK/Math/Matrix3x4d.cs +++ b/Source/OpenTK/Math/Matrix3x4d.cs @@ -239,7 +239,7 @@ namespace OpenTK if (rowIndex == 0) Row0[columnIndex] = value; else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix4.cs b/Source/OpenTK/Math/Matrix4.cs index 798b2c2b..2d311fd5 100644 --- a/Source/OpenTK/Math/Matrix4.cs +++ b/Source/OpenTK/Math/Matrix4.cs @@ -307,7 +307,7 @@ namespace OpenTK else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; else if (rowIndex == 3) Row3[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix4d.cs b/Source/OpenTK/Math/Matrix4d.cs index 9f37d0b5..c4b9387d 100644 --- a/Source/OpenTK/Math/Matrix4d.cs +++ b/Source/OpenTK/Math/Matrix4d.cs @@ -294,7 +294,7 @@ namespace OpenTK else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; else if (rowIndex == 3) Row3[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix4x2.cs b/Source/OpenTK/Math/Matrix4x2.cs index e241623a..d548efda 100644 --- a/Source/OpenTK/Math/Matrix4x2.cs +++ b/Source/OpenTK/Math/Matrix4x2.cs @@ -210,7 +210,7 @@ namespace OpenTK else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; else if (rowIndex == 3) Row3[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix4x2d.cs b/Source/OpenTK/Math/Matrix4x2d.cs index 557d98bf..bf494a19 100644 --- a/Source/OpenTK/Math/Matrix4x2d.cs +++ b/Source/OpenTK/Math/Matrix4x2d.cs @@ -210,7 +210,7 @@ namespace OpenTK else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; else if (rowIndex == 3) Row3[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix4x3.cs b/Source/OpenTK/Math/Matrix4x3.cs index b5f24b97..e7fd6788 100644 --- a/Source/OpenTK/Math/Matrix4x3.cs +++ b/Source/OpenTK/Math/Matrix4x3.cs @@ -242,7 +242,7 @@ namespace OpenTK else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; else if (rowIndex == 3) Row3[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Matrix4x3d.cs b/Source/OpenTK/Math/Matrix4x3d.cs index a5c270b1..908477fd 100644 --- a/Source/OpenTK/Math/Matrix4x3d.cs +++ b/Source/OpenTK/Math/Matrix4x3d.cs @@ -242,7 +242,7 @@ namespace OpenTK else if (rowIndex == 1) Row1[columnIndex] = value; else if (rowIndex == 2) Row2[columnIndex] = value; else if (rowIndex == 3) Row3[columnIndex] = value; - throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); + else throw new IndexOutOfRangeException("You tried to set this matrix at: (" + rowIndex + ", " + columnIndex + ")"); } } diff --git a/Source/OpenTK/Math/Vector2.cs b/Source/OpenTK/Math/Vector2.cs index 8714e354..1ccc885e 100644 --- a/Source/OpenTK/Math/Vector2.cs +++ b/Source/OpenTK/Math/Vector2.cs @@ -121,7 +121,7 @@ namespace OpenTK } set{ if(index == 0) X = value; else if(index == 1) Y = value; - throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); + else throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); } } diff --git a/Source/OpenTK/Math/Vector2d.cs b/Source/OpenTK/Math/Vector2d.cs index c6f50ab7..76140079 100644 --- a/Source/OpenTK/Math/Vector2d.cs +++ b/Source/OpenTK/Math/Vector2d.cs @@ -104,7 +104,7 @@ namespace OpenTK } set{ if(index == 0) X = value; else if(index == 1) Y = value; - throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); + else throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); } } diff --git a/Source/OpenTK/Math/Vector3.cs b/Source/OpenTK/Math/Vector3.cs index 4fe1a7bc..8ec3565d 100644 --- a/Source/OpenTK/Math/Vector3.cs +++ b/Source/OpenTK/Math/Vector3.cs @@ -133,7 +133,7 @@ namespace OpenTK if(index == 0) X = value; else if(index == 1) Y = value; else if(index == 2) Z = value; - throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); + else throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); } } diff --git a/Source/OpenTK/Math/Vector3d.cs b/Source/OpenTK/Math/Vector3d.cs index 3b67ce44..70acdb88 100644 --- a/Source/OpenTK/Math/Vector3d.cs +++ b/Source/OpenTK/Math/Vector3d.cs @@ -131,7 +131,7 @@ namespace OpenTK if(index == 0) X = value; else if(index == 1) Y = value; else if(index == 2) Z = value; - throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); + else throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); } } diff --git a/Source/OpenTK/Math/Vector4.cs b/Source/OpenTK/Math/Vector4.cs index 198066f9..5cb57992 100644 --- a/Source/OpenTK/Math/Vector4.cs +++ b/Source/OpenTK/Math/Vector4.cs @@ -193,7 +193,7 @@ namespace OpenTK else if(index == 1) Y = value; else if(index == 2) Z = value; else if(index == 3) W = value; - throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); + else throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); } } diff --git a/Source/OpenTK/Math/Vector4d.cs b/Source/OpenTK/Math/Vector4d.cs index 236d6db0..6389e48b 100644 --- a/Source/OpenTK/Math/Vector4d.cs +++ b/Source/OpenTK/Math/Vector4d.cs @@ -191,7 +191,7 @@ namespace OpenTK else if(index == 1) Y = value; else if(index == 2) Z = value; else if(index == 3) W = value; - throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); + else throw new IndexOutOfRangeException("You tried to set this vector at index: " + index); } }