Fix: All statuses failed to load when status JSON was checked for boolean values, but received null and would throw a JSONException.
A change in the Mastodon server implementation seemed to be the cause. In the future, either default booleans to false or check for null first before getting them.
This commit is contained in:
		
					parent
					
						
							
								e0ab25334b
							
						
					
				
			
			
				commit
				
					
						c937d30713
					
				
			
		
					 3 changed files with 5 additions and 6 deletions
				
			
		|  | @ -86,8 +86,6 @@ public class MainActivity extends AppCompatActivity { | |||
|         notificationServiceEnabled = preferences.getBoolean("pullNotifications", true); | ||||
|         String minutesString = preferences.getString("pullNotificationCheckInterval", "15"); | ||||
|         long notificationCheckInterval = 60 * 1000 * Integer.valueOf(minutesString); | ||||
|         Log.d(TAG, String.format("pull notifications: %b %dm", notificationServiceEnabled, | ||||
|                 Integer.valueOf(minutesString))); | ||||
|         // Start up the PullNotificationsService. | ||||
|         alarmManager = (AlarmManager) getSystemService(Context.ALARM_SERVICE); | ||||
|         Intent intent = new Intent(this, PullNotificationService.class); | ||||
|  |  | |||
|  | @ -194,8 +194,8 @@ public class Status { | |||
|         String id = object.getString("id"); | ||||
|         String content = object.getString("content"); | ||||
|         Date createdAt = parseDate(object.getString("created_at")); | ||||
|         boolean reblogged = object.getBoolean("reblogged"); | ||||
|         boolean favourited = object.getBoolean("favourited"); | ||||
|         boolean reblogged = object.optBoolean("reblogged"); | ||||
|         boolean favourited = object.optBoolean("favourited"); | ||||
|         String spoilerText = object.getString("spoiler_text"); | ||||
|         boolean sensitive = object.optBoolean("sensitive"); | ||||
|         String visibility = object.getString("visibility"); | ||||
|  |  | |||
|  | @ -24,6 +24,7 @@ import android.support.v4.widget.SwipeRefreshLayout; | |||
| import android.support.v7.widget.DividerItemDecoration; | ||||
| import android.support.v7.widget.LinearLayoutManager; | ||||
| import android.support.v7.widget.RecyclerView; | ||||
| import android.util.Log; | ||||
| import android.view.LayoutInflater; | ||||
| import android.view.View; | ||||
| import android.view.ViewGroup; | ||||
|  | @ -42,6 +43,7 @@ import java.util.Map; | |||
| 
 | ||||
| public class TimelineFragment extends SFragment implements | ||||
|         SwipeRefreshLayout.OnRefreshListener, StatusActionListener, FooterActionListener { | ||||
|     private static final String TAG = "Timeline"; // logging tag | ||||
| 
 | ||||
|     public enum Kind { | ||||
|         HOME, | ||||
|  | @ -176,12 +178,10 @@ public class TimelineFragment extends SFragment implements | |||
|                 break; | ||||
|             } | ||||
|             case TAG: { | ||||
|                 assert(hashtagOrId != null); | ||||
|                 endpoint = String.format(getString(R.string.endpoint_timelines_tag), hashtagOrId); | ||||
|                 break; | ||||
|             } | ||||
|             case USER: { | ||||
|                 assert(hashtagOrId != null); | ||||
|                 endpoint = String.format(getString(R.string.endpoint_statuses), hashtagOrId); | ||||
|                 break; | ||||
|             } | ||||
|  | @ -237,6 +237,7 @@ public class TimelineFragment extends SFragment implements | |||
|     public void onFetchTimelineFailure(Exception exception) { | ||||
|         showFetchTimelineRetry(true); | ||||
|         swipeRefreshLayout.setRefreshing(false); | ||||
|         Log.e(TAG, exception.getMessage()); | ||||
|     } | ||||
| 
 | ||||
|     private void showFetchTimelineRetry(boolean show) { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue