]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wpadebug: Add exception handling for missing resources
authorJouni Malinen <j@w1.fi>
Sun, 5 May 2013 15:28:25 +0000 (18:28 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 5 May 2013 15:28:25 +0000 (18:28 +0300)
These errors should not really happen, but apparently they can if the
build dependencies get messed up somehow.

Signed-hostap: Jouni Malinen <j@w1.fi>

wpadebug/src/w1/fi/wpadebug/CommandListActivity.java
wpadebug/src/w1/fi/wpadebug/WpaCommandListActivity.java

index fb4268ecfba334976a673ac99411eb764b5c6449..6d7ad4dd6678b7a3bddc7a6641de60e8c66889a3 100644 (file)
@@ -77,8 +77,14 @@ public class CommandListActivity extends ListActivity
                           Toast.LENGTH_SHORT).show();
        }
 
-       InputStream inres = getResources().openRawResource(R.raw.shell_commands);
-       read_commands(list, new Scanner(inres));
+       InputStream inres;
+       try {
+           inres = getResources().openRawResource(R.raw.shell_commands);
+           read_commands(list, new Scanner(inres));
+       } catch (android.content.res.Resources.NotFoundException e) {
+           Toast.makeText(this, "Could not read internal resource",
+                          Toast.LENGTH_SHORT).show();
+       }
 
        ArrayAdapter<CmdList> listAdapter;
        listAdapter = new ArrayAdapter<CmdList>(this, android.R.layout.simple_list_item_1, list);
index 4ad9b2d1b54a02fa725a9e2acbf969d58ae43cd9..e089179340eee5d9f6e7cbd3ae800f5ce0b3672b 100644 (file)
@@ -59,8 +59,14 @@ public class WpaCommandListActivity extends ListActivity
                           Toast.LENGTH_SHORT).show();
        }
 
-       InputStream inres = getResources().openRawResource(R.raw.wpa_commands);
-       read_commands(list, new Scanner(inres));
+       InputStream inres;
+       try {
+           inres = getResources().openRawResource(R.raw.wpa_commands);
+           read_commands(list, new Scanner(inres));
+       } catch (android.content.res.Resources.NotFoundException e) {
+           Toast.makeText(this, "Could not read internal resource",
+                          Toast.LENGTH_SHORT).show();
+       }
 
        ArrayAdapter<CmdList> listAdapter;
        listAdapter = new ArrayAdapter<CmdList>(this, android.R.layout.simple_list_item_1, list);