Project

General

Profile

« Previous | Next » 

Revision 7ec268b1

Added by Leszek Koltunski over 4 years ago

Stop crashing when the last installed version has an Object remembered, then we install a new version without this Object in the RubikObjectList.

View differences:

src/main/java/org/distorted/objects/RubikObjectList.java
108 108

  
109 109
  public static RubikObjectList getObject(int ordinal)
110 110
    {
111
    return objects[ordinal];
111
    return ordinal>=0 && ordinal<NUM_OBJECTS ? objects[ordinal] : CUBE;
112 112
    }
113 113

  
114 114
///////////////////////////////////////////////////////////////////////////////////////////////////
......
241 241

  
242 242
  public static int getSizeIndex(int ordinal, int size)
243 243
    {
244
    int[] sizes = objects[ordinal].getSizes();
245
    int len = sizes.length;
246

  
247
    for(int i=0; i<len; i++)
244
    if( ordinal>=0 && ordinal<NUM_OBJECTS )
248 245
      {
249
      if( sizes[i]==size ) return i;
246
      int[] sizes = objects[ordinal].getSizes();
247
      int len = sizes.length;
248

  
249
      for(int i=0; i<len; i++)
250
        {
251
        if( sizes[i]==size ) return i;
252
        }
250 253
      }
251 254

  
252 255
    return -1;

Also available in: Unified diff