mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-25 19:35:53 +00:00
Fixed possible NPE in SyncthingRunnable (fixes #335).
This commit is contained in:
parent
ffab06ff12
commit
f110e02718
1 changed files with 6 additions and 7 deletions
|
@ -9,7 +9,6 @@ import android.util.Log;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
@ -79,10 +78,12 @@ public class SyncthingRunnable implements Runnable {
|
||||||
Log.e(TAG, "Failed to execute syncthing binary or read output", e);
|
Log.e(TAG, "Failed to execute syncthing binary or read output", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
if (dos != null)
|
||||||
dos.close();
|
dos.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Failed to close shell stream", e);
|
Log.w(TAG, "Failed to close shell stream", e);
|
||||||
}
|
}
|
||||||
|
if (process != null)
|
||||||
process.destroy();
|
process.destroy();
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
Log.e(TAG_NATIVE, "Syncthing binary crashed with error code " +
|
Log.e(TAG_NATIVE, "Syncthing binary crashed with error code " +
|
||||||
|
@ -158,9 +159,8 @@ public class SyncthingRunnable implements Runnable {
|
||||||
Log.w(TAG_KILL, "Failed list Syncthing processes", e);
|
Log.w(TAG_KILL, "Failed list Syncthing processes", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (psOut != null) {
|
if (psOut != null)
|
||||||
psOut.close();
|
psOut.close();
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG_KILL, "Failed close the psOut stream", e);
|
Log.w(TAG_KILL, "Failed close the psOut stream", e);
|
||||||
}
|
}
|
||||||
|
@ -197,9 +197,8 @@ public class SyncthingRunnable implements Runnable {
|
||||||
Log.w(TAG_KILL, "Failed to kill process id "+id, e);
|
Log.w(TAG_KILL, "Failed to kill process id "+id, e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (killOut != null) {
|
if (killOut != null)
|
||||||
killOut.close();
|
killOut.close();
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG_KILL, "Failed close the killOut stream", e);}
|
Log.w(TAG_KILL, "Failed close the killOut stream", e);}
|
||||||
if (kill != null) {
|
if (kill != null) {
|
||||||
|
|
Loading…
Reference in a new issue