]> git.mxchange.org Git - simgear.git/commitdiff
ShivaVG: check for zero before dividing.
authorThomas Geymayer <tomgey@gmail.com>
Sat, 21 Jun 2014 10:26:58 +0000 (12:26 +0200)
committerThomas Geymayer <tomgey@gmail.com>
Sat, 21 Jun 2014 10:26:58 +0000 (12:26 +0200)
simgear/canvas/ShivaVG/src/shVectors.c

index 53bb1969c6ec820b97b9355564594ff52e07b97f..1fb59eb6f1cb407b0bbb7f6058014481893f758c 100644 (file)
@@ -124,11 +124,13 @@ int shLineLineXsection(SHVector2 *o1, SHVector2 *v1,
   SHfloat DX = rightU * (-v2->y) - rightD * (-v2->x);
 /*SHfloat DY = v1.x   * rightD  - v1.y   * rightU;*/
   
-  SHfloat t1 = DX / D;
+  SHfloat t1;
   
   if (D == 0.0f)
     return 0;
-  
+
+  t1 = DX / D;
+
   xsection->x = o1->x + t1*v1->x;
   xsection->y = o1->y + t1*v1->y;
   return 1;