Browse Source

Fixed crash; see issue 415.

pull/11/head
Eric Kok 12 years ago
parent
commit
012f1390ff
  1. 2
      android/res/layout/part_details_header.xml
  2. 5
      android/src/org/transdroid/gui/DetailsListAdapter.java
  3. 8
      lib/src/org/transdroid/daemon/Transmission/TransmissionAdapter.java

2
android/res/layout/part_details_header.xml

@ -65,7 +65,7 @@
</TableRow> </TableRow>
<TableRow android:id="@+id/detailsrow_errors2" android:visibility="gone" > <TableRow android:id="@+id/detailsrow_errors2" android:visibility="gone" >
<TextView android:id="@+id/details_errors" style="@style/DetailsInfoText" <TextView android:id="@+id/details_errors" style="@style/DetailsInfoText"
android:layout_span="2" /> android:layout_span="2" android:autoLink="web" />
</TableRow> </TableRow>
</TableLayout> </TableLayout>

5
android/src/org/transdroid/gui/DetailsListAdapter.java

@ -147,7 +147,7 @@ public class DetailsListAdapter extends MergeAdapter {
(fineDetails != null && fineDetails.getErrors() != null && !fineDetails.getErrors().isEmpty()? "\n" + fineDetails.getErrorsText(): ""): (fineDetails != null && fineDetails.getErrors() != null && !fineDetails.getErrors().isEmpty()? "\n" + fineDetails.getErrorsText(): ""):
(fineDetails != null && fineDetails.getErrors() != null && !fineDetails.getErrors().isEmpty()? fineDetails.getErrorsText(): (fineDetails != null && fineDetails.getErrors() != null && !fineDetails.getErrors().isEmpty()? fineDetails.getErrorsText():
null); null);
if (errorsText == null) { if (errorsText == null || errorsText.equals("")) {
errors.setText(""); errors.setText("");
errorshint.setText(""); errorshint.setText("");
} else { } else {
@ -155,8 +155,9 @@ public class DetailsListAdapter extends MergeAdapter {
if (showingErrors) { if (showingErrors) {
errorshint.setText(detailsFragment.getString(R.string.details_trackers_collapse)); errorshint.setText(detailsFragment.getString(R.string.details_trackers_collapse));
} else { } else {
String[] err = errorsText.split("\n");
errorshint.setText(detailsFragment.getString(R.string.details_trackers_expand, errorshint.setText(detailsFragment.getString(R.string.details_trackers_expand,
errorsText.split("\n")[0])); err.length >= 0? err[0]: ""));
} }
} }

8
lib/src/org/transdroid/daemon/Transmission/TransmissionAdapter.java

@ -473,9 +473,11 @@ public class TransmissionAdapter implements IDaemonAdapter {
// Error is a number, see https://trac.transmissionbt.com/browser/trunk/libtransmission/transmission.h#L1747 // Error is a number, see https://trac.transmissionbt.com/browser/trunk/libtransmission/transmission.h#L1747
// We only consider it a real error if it is local (blocking), which is error code 3 // We only consider it a real error if it is local (blocking), which is error code 3
boolean hasError = tor.getInt(RPC_ERROR) == 3; boolean hasError = tor.getInt(RPC_ERROR) == 3;
String errorString = tor.getString(RPC_ERRORSTRING); String errorString = tor.getString(RPC_ERRORSTRING).trim();
String commentString = tor.getString(RPC_COMMENT); String commentString = tor.getString(RPC_COMMENT).trim();
errorString = errorString == ""? commentString : errorString + "\n" + commentString; if (!commentString.equals("")) {
errorString = errorString.equals("")? commentString : errorString + "\n" + commentString;
}
torrents.add(new Torrent( torrents.add(new Torrent(
tor.getInt(RPC_ID), tor.getInt(RPC_ID),
null, null,

Loading…
Cancel
Save