Maarten Lankhorst : dsound: Make AngleBetweenVectorsRad when vectors have no magnitude.

Alexandre Julliard julliard at winehq.org
Mon Nov 12 06:25:42 CST 2007


Module: wine
Branch: master
Commit: 3f965d582fbcc7f6e596a61541b93a1286501706
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=3f965d582fbcc7f6e596a61541b93a1286501706

Author: Maarten Lankhorst <maarten at codeweavers.com>
Date:   Fri Nov  9 20:13:01 2007 +0100

dsound: Make AngleBetweenVectorsRad when vectors have no magnitude.

---

 dlls/dsound/sound3d.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c
index db4390f..2397f52 100644
--- a/dlls/dsound/sound3d.c
+++ b/dlls/dsound/sound3d.c
@@ -110,6 +110,9 @@ static inline D3DVALUE AngleBetweenVectorsRad (const D3DVECTOR *a, const D3DVECT
 	product = ScalarProduct (a,b);
 	la = VectorMagnitude (a);
 	lb = VectorMagnitude (b);
+	if (!la || !lb)
+		return 0;
+
 	cos = product/(la*lb);
 	angle = acos(cos);
 	TRACE("angle between (%f,%f,%f) and (%f,%f,%f) = %f radians (%f degrees)\n",  a->x, a->y, a->z, b->x,




More information about the wine-cvs mailing list