@@ -105,10 +105,6 @@ private HSSource(Context context) {
105
105
setGear (HSHelpStack .getInstance (context ).getGear ());
106
106
mRequestQueue = HSHelpStack .getInstance (context ).getRequestQueue ();
107
107
108
- cachedTicket = new HSCachedTicket ();
109
- cachedUser = new HSCachedUser ();
110
- draftObject = new HSDraft ();
111
-
112
108
refreshFieldsFromCache ();
113
109
}
114
110
@@ -452,7 +448,10 @@ protected void doReadTicketsFromCache() {
452
448
453
449
String json = readJsonFromFile (ticketFile );
454
450
455
- if (json != null ) {
451
+ if (json == null ) {
452
+ cachedTicket = new HSCachedTicket ();
453
+ }
454
+ else {
456
455
Gson gson = new Gson ();
457
456
cachedTicket = gson .fromJson (json , HSCachedTicket .class );
458
457
}
@@ -466,7 +465,10 @@ protected void doReadUserFromCache() {
466
465
467
466
String json = readJsonFromFile (userFile );
468
467
469
- if (json != null ) {
468
+ if (json == null ) {
469
+ cachedUser = new HSCachedUser ();
470
+ }
471
+ else {
470
472
Gson gson = new Gson ();
471
473
cachedUser = gson .fromJson (json , HSCachedUser .class );
472
474
}
@@ -477,8 +479,11 @@ protected void doReadDraftFromCache() {
477
479
478
480
String json = readJsonFromFile (draftFile );
479
481
480
- if (json != null ) {
481
- Gson gson = new Gson ();
482
+ if (json == null ) {
483
+ draftObject = new HSDraft ();
484
+ }
485
+ else {
486
+ Gson gson = new Gson ();
482
487
draftObject = gson .fromJson (json , HSDraft .class );
483
488
}
484
489
}
0 commit comments