Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 824392bd authored by Christopher Tate's avatar Christopher Tate
Browse files

Don't crash just because invalid datasets were offered for restore

In practice, recognize that the current transport state may not yet
incorporate a valid restore data stream object, so don't go making
assumptions that it's usable / closeable / etc.

Bug 18379004

Change-Id: I221e04b5b83438e37455e025d67f412d3abb8c50
parent 2f8d4ea2
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -35,6 +35,8 @@ import android.util.Log;

import com.android.org.bouncycastle.util.encoders.Base64;

import libcore.io.IoUtils;

import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
@@ -559,11 +561,7 @@ public class LocalTransport extends BackupTransport {
    // Full restore handling

    private void resetFullRestoreState() {
        try {
        mCurFullRestoreStream.close();
        } catch (IOException e) {
            Log.w(TAG, "Unable to close full restore input stream");
        }
        IoUtils.closeQuietly(mCurFullRestoreStream);
        mCurFullRestoreStream = null;
        mFullRestoreSocketStream = null;
        mFullRestoreBuffer = null;