Skip to content

Commit

Permalink
[android] cast crash fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
gubatron committed Mar 17, 2016
1 parent f6755ce commit 9a27285
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public List<T> getList() {
public boolean[] getSelected() {
boolean[] result = new boolean[0];
if (adapter != null) {
List<T> checked = (List<T>) adapter.getChecked();
Set<T> checked = adapter.getChecked();
if (checked == null || checked.isEmpty()) {
return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private long getTotalSize(List<SoundcloudSearchResult> results) {

@Override
protected void onPostExecute(Context ctx, List<SoundcloudSearchResult> results) {
if (!results.isEmpty()) {
if (ctx != null && !results.isEmpty()) {
MainActivity activity = (MainActivity) ctx;
ConfirmSoundcloudDownloadDialog dlg = createConfirmListDialog(ctx, results);
dlg.show(activity.getFragmentManager());
Expand All @@ -78,20 +78,15 @@ protected void onPostExecute(Context ctx, List<SoundcloudSearchResult> results)
@Override
protected List<SoundcloudSearchResult> doInBackground() {
List<SoundcloudSearchResult> results = new ArrayList<>();

try {
String url = soundcloudUrl;
if (soundcloudUrl.contains("?in=")) {
url = soundcloudUrl.substring(0, url.indexOf("?in="));
}

String resolveURL = SoundcloudSearchPerformer.resolveUrl(url);

HttpClient client = HttpClientFactory.getInstance(HttpClientFactory.HttpContext.DOWNLOAD);
String json = client.get(resolveURL, 10000);

results = SoundcloudSearchPerformer.fromJson(json);

} catch (Throwable e) {
e.printStackTrace();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public AbstractDialog(String tag, int layoutResId) {
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);

activityRef = Ref.weak(activity);
}

Expand Down

0 comments on commit 9a27285

Please sign in to comment.