commit f8ce34ab7d53d7dbe51b4d7ee6856685f2797f84
Author: Leszek Koltunski <leszek@koltunski.pl>
Date:   Sun Apr 26 15:23:18 2020 +0100

    Fix for the previous fix :)

diff --git a/src/main/java/org/distorted/objects/Cubit.java b/src/main/java/org/distorted/objects/Cubit.java
index b277e435..7fbb2f4f 100644
--- a/src/main/java/org/distorted/objects/Cubit.java
+++ b/src/main/java/org/distorted/objects/Cubit.java
@@ -21,6 +21,8 @@ package org.distorted.objects;
 
 import android.content.SharedPreferences;
 
+import com.google.firebase.crashlytics.FirebaseCrashlytics;
+
 import org.distorted.library.effect.MatrixEffectMove;
 import org.distorted.library.effect.MatrixEffectQuaternion;
 import org.distorted.library.effect.MatrixEffectRotate;
@@ -338,6 +340,25 @@ class Cubit
     mRotationAngle.add(mParent.mRotationAngleFinal);
     }
 
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+  float getAngle()
+    {
+    int pointNum = mRotationAngle.getNumPoints();
+
+    if( pointNum>=1 )
+      {
+      return mRotationAngle.getPoint(pointNum-1).get0();
+      }
+    else
+      {
+      FirebaseCrashlytics crashlytics = FirebaseCrashlytics.getInstance();
+      crashlytics.setCustomKey("getAngle", "points in RotationAngle: "+pointNum );
+      crashlytics.log("points in RotationAngle: "+pointNum);
+      return 0;
+      }
+    }
+
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 // all DistortedTextures, DistortedNodes, DistortedFramebuffers, DistortedScreens and all types of
 // Meshes HAVE TO be markedForDeletion when they are no longer needed- otherwise we have a major
diff --git a/src/main/java/org/distorted/objects/RubikObject.java b/src/main/java/org/distorted/objects/RubikObject.java
index 202228a6..94f666f1 100644
--- a/src/main/java/org/distorted/objects/RubikObject.java
+++ b/src/main/java/org/distorted/objects/RubikObject.java
@@ -487,7 +487,7 @@ public abstract class RubikObject extends DistortedNode
           {
           firstCubit=i;
 
-          float angle = mRotationAngleStatic.get0();
+          float angle = mCubits[i].getAngle();
           int nearestAngleInDegrees = computeNearestAngle(angle);
           mRotationAngleStatic.set0(angle);
           mRotationAngleFinal.set0(nearestAngleInDegrees);
@@ -516,7 +516,7 @@ public abstract class RubikObject extends DistortedNode
            {
            first = false;
 
-           float angle = mRotationAngleFinal.get0();
+           float angle = mCubits[i].getAngle();
            int nearestAngleInDegrees = computeNearestAngle(angle);
            double nearestAngleInRadians = nearestAngleInDegrees*Math.PI/180;
            float sinA =-(float)Math.sin(nearestAngleInRadians*0.5);
