Skip to content

Commit

Permalink
NClientV2 2.8.2
Browse files Browse the repository at this point in the history
* NullPointer fixes
  • Loading branch information
Dar9586 committed Jul 14, 2021
1 parent bddca35 commit 598974d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/com/dar/nclientv2/SettingsActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import android.os.Bundle;
import android.provider.Settings;
import android.view.MenuItem;
import android.widget.Toast;

import androidx.activity.result.ActivityResultLauncher;
import androidx.activity.result.contract.ActivityResultContract;
Expand Down Expand Up @@ -67,6 +68,7 @@ public Intent createIntent(@NonNull Context context, @NonNull String input) {
return i;
}
}, selectedFile -> {
if (selectedFile == null) return;
try {
Exporter.exportData(this, selectedFile);
} catch (IOException e) {
Expand Down Expand Up @@ -118,6 +120,10 @@ public boolean onOptionsItemSelected(MenuItem item) {

@TargetApi(Build.VERSION_CODES.R)
public void requestStorageManager() {
if (REQUEST_STORAGE_MANAGER == null) {
Toast.makeText(this, R.string.failed, Toast.LENGTH_SHORT).show();
return;
}
MaterialAlertDialogBuilder builder = new MaterialAlertDialogBuilder(this);
builder.setIcon(R.drawable.ic_file);
builder.setTitle(R.string.requesting_storage_access);
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/com/dar/nclientv2/utility/LogUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public class LogUtility {

public static void d(Object... message) {
if (message == null) return;
if (message.length == 1) Log.d(LogUtility.LOGTAG, message[0].toString());
if (message.length == 1) Log.d(LogUtility.LOGTAG, "" + message[0]);
else Log.d(LogUtility.LOGTAG, Arrays.toString(message));
}

Expand All @@ -20,7 +20,7 @@ public static void d(Object message, Throwable throwable) {

public static void i(Object... message) {
if (message == null) return;
if (message.length == 1) Log.i(LogUtility.LOGTAG, message[0].toString());
if (message.length == 1) Log.i(LogUtility.LOGTAG, "" + message[0]);
else Log.i(LogUtility.LOGTAG, Arrays.toString(message));
}

Expand All @@ -31,7 +31,7 @@ public static void i(Object message, Throwable throwable) {

public static void e(Object... message) {
if (message == null) return;
if (message.length == 1) Log.e(LogUtility.LOGTAG, message[0].toString());
if (message.length == 1) Log.e(LogUtility.LOGTAG, "" + message[0]);
else Log.e(LogUtility.LOGTAG, Arrays.toString(message));
}

Expand Down

0 comments on commit 598974d

Please sign in to comment.