more protections against invalid copy operations
This commit is contained in:
parent
68a401a463
commit
85f57cd733
|
@ -289,6 +289,8 @@ namespace Blarg.GameFramework.Graphics
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null)
|
||||||
throw new ArgumentNullException("source");
|
throw new ArgumentNullException("source");
|
||||||
|
if (source.NumElements <= 0)
|
||||||
|
throw new InvalidOperationException();
|
||||||
|
|
||||||
Copy(source, destVertexIndex, 0, source.NumElements);
|
Copy(source, destVertexIndex, 0, source.NumElements);
|
||||||
}
|
}
|
||||||
|
@ -297,6 +299,8 @@ namespace Blarg.GameFramework.Graphics
|
||||||
{
|
{
|
||||||
if (source == null)
|
if (source == null)
|
||||||
throw new ArgumentNullException("source");
|
throw new ArgumentNullException("source");
|
||||||
|
if (source.NumElements <= 0)
|
||||||
|
throw new InvalidOperationException();
|
||||||
if (destVertexIndex <= 0 || destVertexIndex >= NumElements)
|
if (destVertexIndex <= 0 || destVertexIndex >= NumElements)
|
||||||
throw new ArgumentOutOfRangeException("destVertexIndex");
|
throw new ArgumentOutOfRangeException("destVertexIndex");
|
||||||
if (sourceVertexIndex <= 0 || sourceVertexIndex >= source.NumElements)
|
if (sourceVertexIndex <= 0 || sourceVertexIndex >= source.NumElements)
|
||||||
|
|
Reference in a new issue