Project

General

Profile

« Previous | Next » 

Revision c020555e

Added by Leszek Koltunski almost 2 years ago

Do not crash when something's wrong with the JSON file - handle this gracefully, do not change the object then, and report this to Firebase.

View differences:

src/main/java/org/distorted/dialogs/RubikDialogUpdateView.java
201 201

  
202 202
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Saving JSON "+name+" to a file "+oSuccess);
203 203

  
204
        JsonReader reader = JsonReader.getInstance();
205
        mInfo.mNumScrambles = reader.readNumScrambles(act,name);
206

  
207
        if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Read from JSON numScrambles="+mInfo.mNumScrambles);
204
        try
205
          {
206
          JsonReader reader = JsonReader.getInstance();
207
          mInfo.mNumScrambles = reader.readNumScrambles(act,name);
208
          if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Read from JSON numScrambles="+mInfo.mNumScrambles);
209
          }
210
        catch(Exception ex)
211
          {
212
          mInfo.mNumScrambles = 25;
213
          if( SHOW_DOWNLOADED_DEBUG ) android.util.Log.e("D", "Error reading numScrambles");
214
          }
208 215
        }
209 216

  
210 217
      if( mInfo.mExtrasStream!=null )

Also available in: Unified diff