[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] for #381 make sure apps array is not null



commit e183d443bedf598c71f74e2edeb3e99d32d88dc5
Author: n8fr8 <nathan@xxxxxxxxxxxxxxxxxxxx>
Date:   Thu Aug 20 09:12:52 2020 -0400

    for #381 make sure apps array is not null
---
 .../torproject/android/ui/AppManagerActivity.java  | 40 +++++++++++-----------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java b/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
index 5c071b23..07c36ac7 100644
--- a/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
+++ b/app/src/main/java/org/torproject/android/ui/AppManagerActivity.java
@@ -160,31 +160,31 @@ public class AppManagerActivity extends AppCompatActivity implements OnClickList
                     convertView.setTag(entry);
                 }
 
-                final TorifiedApp app = mApps.get(position);
+                if (mApps != null) {
+                    final TorifiedApp app = mApps.get(position);
 
-                if (entry.icon != null) {
+                    if (entry.icon != null) {
 
-                    try {
-                        entry.icon.setImageDrawable(pMgr.getApplicationIcon(app.getPackageName()));
-                        entry.icon.setOnClickListener(AppManagerActivity.this);
-                        entry.icon.setTag(entry.box);
-                    }
-                    catch (Exception e)
-                    {
-                        e.printStackTrace();
+                        try {
+                            entry.icon.setImageDrawable(pMgr.getApplicationIcon(app.getPackageName()));
+                            entry.icon.setOnClickListener(AppManagerActivity.this);
+                            entry.icon.setTag(entry.box);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
                     }
-                }
 
-                if (entry.text != null) {
-                    entry.text.setText(app.getName());
-                    entry.text.setOnClickListener(AppManagerActivity.this);
-                    entry.text.setTag(entry.box);
-                }
+                    if (entry.text != null) {
+                        entry.text.setText(app.getName());
+                        entry.text.setOnClickListener(AppManagerActivity.this);
+                        entry.text.setTag(entry.box);
+                    }
 
-                if (entry.box != null) {
-                    entry.box.setOnClickListener(AppManagerActivity.this);
-                    entry.box.setChecked(app.isTorified());
-                    entry.box.setTag(app);
+                    if (entry.box != null) {
+                        entry.box.setOnClickListener(AppManagerActivity.this);
+                        entry.box.setChecked(app.isTorified());
+                        entry.box.setTag(app);
+                    }
                 }
 
                 return convertView;



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits