diff --git a/Skeleton.cpp b/Skeleton.cpp
index 007a6662fbe79695cef184a4572a9c695db1fced..af2d2dc9815b57d7910fcb489eba1a95b1a5a1bf 100644
--- a/Skeleton.cpp
+++ b/Skeleton.cpp
@@ -177,12 +177,14 @@ public:
         auto _c = a * ray.start.x * ray.start.x + b * ray.start.y * ray.start.y - c * ray.start.z;
         
         auto discriminant = _b*_b - 4*_a*_c;
-        auto s_disc = sqrt(discriminant);
         
-        if (s_disc < 0) {
+        if (discriminant < 0) {
+            hit.t = -1;
             return hit;
         }
         
+        auto s_disc = sqrt(discriminant);
+        
         auto t1 = (-_b+s_disc)/(2*_a);
         auto t2 = (-_b-s_disc)/(2*_a);