Skip to content

Commit

Permalink
Fix crash on initial database create
Browse files Browse the repository at this point in the history
  • Loading branch information
bpellin committed May 22, 2020
1 parent a9f745b commit 7c7b15e
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions app/src/main/java/com/keepassdroid/SetPasswordDialog.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2009-2016 Brian Pellin.
* Copyright 2009-2020 Brian Pellin.
*
* This file is part of KeePassDroid.
*
Expand All @@ -19,6 +19,7 @@
*/
package com.keepassdroid;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.net.Uri;
Expand All @@ -43,12 +44,14 @@ public class SetPasswordDialog extends CancelDialog {
private Uri mKeyfile;
private FileOnFinish mFinish;

public SetPasswordDialog(Context context) {
super(context);
public SetPasswordDialog(Activity act) {
super(act);

setOwnerActivity(act);
}

public SetPasswordDialog(Context context, FileOnFinish finish) {
super(context);
public SetPasswordDialog(Activity act, FileOnFinish finish) {
this(act);
mFinish = finish;
}

Expand Down Expand Up @@ -96,7 +99,8 @@ public void onClick(View v) {
}

SetPassword sp = new SetPassword(getContext(), App.getDB(), pass, keyfile, new AfterSave(mFinish, new Handler()));
final ProgressTask pt = new ProgressTask(getOwnerActivity(), sp, R.string.saving_database);
Activity act = getOwnerActivity();
final ProgressTask pt = new ProgressTask(act, sp, R.string.saving_database);
boolean valid = sp.validatePassword(getContext(), new OnClickListener() {

@Override
Expand Down

0 comments on commit 7c7b15e

Please sign in to comment.