Project

General

Profile

« Previous | Next » 

Revision 0ac2c2e6

Added by Leszek Koltunski about 2 years ago

lame work around for a crasher. At least it's not going to crash now.

View differences:

src/main/java/org/distorted/objectlib/helpers/ObjectSignature.java
61 61
    mNumCubitTouches       = sig.mNumCubitTouches;
62 62
    mNumCentCyclesPerLayer = sig.mNumCentCyclesPerLayer;
63 63
    mNumLeftCyclesPerLayer = sig.mNumLeftCyclesPerLayer;
64
    mNumInneCyclesPerLayer = sig.mNumInneCyclesPerLayer;
64 65
    }
65 66

  
66 67
///////////////////////////////////////////////////////////////////////////////////////////////////
......
221 222
  public ObjectSignature turn(int axis, int layer, int turn)
222 223
    {
223 224
    ObjectSignature ret = new ObjectSignature(this);
224
    int[][] cycles = mCycles[axis][layer];
225 225

  
226
    // it can happen that there are no cycles: 2x1x2 axis 0 layer 0.
227
    if( cycles!=null && cycles.length>0 && cycles[0]!=null )
226
    // I don't understand it, but Firebase shows mCycles is occasionally null here.
227
    if( mCycles!=null && mCycles[axis]!=null )
228 228
      {
229
      if( cycles[0].length==4 ) for(int[] cyc : cycles) ret.cycle4(turn,cyc);
230
      else                      for(int[] cyc : cycles) ret.cycle2(cyc);
229
      int[][] cycles = mCycles[axis][layer];
230

  
231
      // it can happen that there are no cycles in this layer: 2x1x2 axis 0 layer 0.
232
      if( cycles!=null && cycles.length>0 && cycles[0]!=null )
233
        {
234
        if( cycles[0].length==4 ) for(int[] cyc : cycles) ret.cycle4(turn,cyc);
235
        else                      for(int[] cyc : cycles) ret.cycle2(cyc);
236
        }
231 237
      }
232 238

  
233 239
    return ret;

Also available in: Unified diff