Prevent crash

This commit is contained in:
M66B
2020-10-30 10:36:16 +01:00
parent aea6a79019
commit 3c8c9da858
27 changed files with 133697 additions and 229 deletions

View File

@@ -1190,9 +1190,7 @@ public class Log {
final Throwable ex = (Throwable) getArguments().getSerializable("ex");
boolean report = getArguments().getBoolean("report", true);
final Context context = getContext();
AlertDialog.Builder builder = new AlertDialog.Builder(context)
AlertDialog.Builder builder = new AlertDialog.Builder(getContext())
.setTitle(R.string.title_unexpected_error)
.setMessage(Log.formatThrowable(ex, false))
.setPositiveButton(android.R.string.cancel, null);
@@ -1201,6 +1199,9 @@ public class Log {
builder.setNeutralButton(R.string.title_report, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// Dialog will be dismissed
final Context context = getContext();
new SimpleTask<Long>() {
@Override
protected Long onExecute(Context context, Bundle args) throws Throwable {
@@ -1221,7 +1222,7 @@ public class Log {
else
ToastEx.makeText(context, ex.toString(), Toast.LENGTH_LONG).show();
}
}.execute(context, getActivity(), new Bundle(), "error:unexpected");
}.execute(getContext(), getActivity(), new Bundle(), "error:unexpected");
}
});