diff --git a/Lib/csharp/std_vector.i b/Lib/csharp/std_vector.i index e2811290c..ecb10dfbb 100644 --- a/Lib/csharp/std_vector.i +++ b/Lib/csharp/std_vector.i @@ -63,7 +63,7 @@ return (int)capacity(); } set { - if (value < size()) + if (value < 0 || ($typemap(cstype, size_t))value < size()) throw new global::System.ArgumentOutOfRangeException("Capacity"); reserve(($typemap(cstype, size_t))value); }