miracle8304 / aforge

Automatically exported from code.google.com/p/aforge
0 stars 0 forks source link

Need to provide handling of invalid parameters (like null) #237

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1.

System.NullReferenceException: Object reference not set to an instance of an 
object.    D:\AForge.NET\Sources\Core\DoubleRange.cs(123): at System.Boolean 
AForge.DoubleRange.IsInside(AForge.DoubleRange range) 
      at System.Boolean AForge.DoubleRangeTest.IsInside01(AForge.DoubleRange target, AForge.DoubleRange range) 

DoubleRange s0 = new DoubleRange(0, 0);
bool b = this.IsInside01(s0, (DoubleRange)null);

2.

System.NullReferenceException: Object reference not set to an instance of an 
object.    D:\AForge.NET\Sources\Core\DoubleRange.cs(137): at System.Boolean 
AForge.DoubleRange.IsOverlapping(AForge.DoubleRange range) 
      at System.Boolean AForge.DoubleRangeTest.IsOverlapping(AForge.DoubleRange target, AForge.DoubleRange range) 

DoubleRange s0 = new DoubleRange(0, 0);
bool b = this.IsOverlapping(s0, (DoubleRange)null);

3.

System.DivideByZeroException: Attempted to divide by zero.    
D:\AForge.NET\Sources\Core\IntPoint.cs(164): at AForge.IntPoint 
AForge.IntPoint.op_Division(AForge.IntPoint p, System.Int32 factor) 
      at AForge.IntPoint AForge.IntPointTest.op_Division(AForge.IntPoint p, System.Int32 factor) 

IntPoint intPoint = this.op_Division(default(IntPoint), 0);

4.

System.OverflowException: Arithmetic operation resulted in an overflow.    
D:\AForge.NET\Sources\Core\IntPoint.cs(164): at AForge.IntPoint 
AForge.IntPoint.op_Division(AForge.IntPoint p, System.Int32 factor) 
      at AForge.IntPoint AForge.IntPointTest.op_Division(AForge.IntPoint p, System.Int32 factor) 

IntPoint s0 = default(IntPoint);
s0.X = default(int);
s0.Y = int.MinValue;
IntPoint intPoint = this.op_Division(s0, -1);

5. 

System.NullReferenceException: Object reference not set to an instance of an 
object.    D:\AForge.NET\Sources\Core\IntRange.cs(122): at System.Boolean 
AForge.IntRange.IsInside(AForge.IntRange range) 
      at System.Boolean AForge.IntRangeTest.IsInside01(AForge.IntRange target, AForge.IntRange range) 

IntRange s0 = new IntRange(0, 0);
bool b = this.IsInside01(s0, (IntRange)null);

6.

System.NullReferenceException: Object reference not set to an instance of an 
object.    D:\AForge.NET\Sources\Core\IntRange.cs(136): at System.Boolean 
AForge.IntRange.IsOverlapping(AForge.IntRange range) 
      at System.Boolean AForge.IntRangeTest.IsOverlapping(AForge.IntRange target, AForge.IntRange range) 

IntRange s0 = new IntRange(0, 0);
bool b = this.IsOverlapping(s0, (IntRange)null);

Original issue reported on code.google.com by krzysztof.blacha on 31 Jul 2011 at 7:46