Skip to content
Browse files

Handle rare crashes in My Shows.

Sometimes the "startTime" is defined on the recording, but not the item.  Seek it in both places, and check for null before using it, in case it is in neither.
  • Loading branch information...
1 parent 696d37f commit db2a3ad2f9acda0b7010065b47459766ecebd411 @arantius committed Nov 7, 2011
Showing with 9 additions and 4 deletions.
  1. +9 −4 src/com/arantius/tivocommander/MyShows.java
View
13 src/com/arantius/tivocommander/MyShows.java
@@ -92,6 +92,7 @@ public View getView(int position, View convertView, ViewGroup parent) {
// If this item is available, display it.
v = vi.inflate(R.layout.item_my_shows, null);
final JsonNode item = mShowData.get(position);
+ final JsonNode recording = item.path("recordingForChildRecordingId");
String title = item.path("title").getTextValue();
if ('"' == title.charAt(0) && '"' == title.charAt(title.length() - 1)) {
@@ -104,17 +105,21 @@ public View getView(int position, View convertView, ViewGroup parent) {
.setText(folderItemCount > 0 ? folderItemCount.toString() : "");
String channelStr = "";
- JsonNode channel =
- item.path("recordingForChildRecordingId").path("channel");
+ JsonNode channel = recording.path("channel");
if (folderItemCount == 0 && !channel.isMissingNode()) {
channelStr =
String.format("%s %s", channel.path("channelNumber")
.getTextValue(), channel.path("callSign").getTextValue());
}
((TextView) v.findViewById(R.id.show_channel)).setText(channelStr);
- if ("1970"
- .equals(item.path("startTime").getTextValue().substring(0, 4))) {
+ String startTimeStr = item.path("startTime").getTextValue();
+ if (startTimeStr == null) {
+ // Rarely the time is only on the recording, not the item.
+ startTimeStr = recording.path("startTime").getTextValue();
+ }
+
+ if (startTimeStr == null || "1970".equals(startTimeStr.substring(0, 4))) {
v.findViewById(R.id.show_time).setVisibility(View.GONE);
} else {
Date startTime =

0 comments on commit db2a3ad

Please sign in to comment.
Something went wrong with that request. Please try again.