mirror of
https://github.com/syncthing/syncthing-android.git
synced 2025-01-10 20:15:54 +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.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
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);
|
||||
} finally {
|
||||
try {
|
||||
if (dos != null)
|
||||
dos.close();
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to close shell stream", e);
|
||||
}
|
||||
if (process != null)
|
||||
process.destroy();
|
||||
if (ret != 0) {
|
||||
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);
|
||||
} finally {
|
||||
try {
|
||||
if (psOut != null) {
|
||||
if (psOut != null)
|
||||
psOut.close();
|
||||
}
|
||||
} catch (IOException 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);
|
||||
} finally {
|
||||
try {
|
||||
if (killOut != null) {
|
||||
if (killOut != null)
|
||||
killOut.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG_KILL, "Failed close the killOut stream", e);}
|
||||
if (kill != null) {
|
||||
|
|
Loading…
Reference in a new issue