fix another NullPtrException (cannot log null)

This commit is contained in:
Philipp Crocoll 2016-02-15 21:23:48 +01:00
parent c694ed0f96
commit 8b192b4796
2 changed files with 66 additions and 21 deletions

View File

@ -90,7 +90,7 @@
<file leaf-file-name="strings_autofill.xml" pinned="false" current-in-tab="false"> <file leaf-file-name="strings_autofill.xml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings_autofill.xml"> <entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings_autofill.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="-4.08">
<caret line="6" column="70" selection-start-line="6" selection-start-column="70" selection-end-line="6" selection-end-column="70" /> <caret line="6" column="70" selection-start-line="6" selection-start-column="70" selection-end-line="6" selection-end-column="70" />
<folding /> <folding />
</state> </state>
@ -100,10 +100,27 @@
<file leaf-file-name="AutoFillService.java" pinned="false" current-in-tab="true"> <file leaf-file-name="AutoFillService.java" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java"> <entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.5014663">
<caret line="149" column="44" selection-start-line="149" selection-start-column="44" selection-end-line="149" selection-end-column="44" /> <caret line="382" column="32" selection-start-line="382" selection-start-column="28" selection-end-line="382" selection-end-column="32" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="docComment;class#AutoFillService#0" expanded="false" />
<element signature="method#onDestroy#0;class#AutoFillService#0" expanded="false" />
<element signature="class#NodeCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#WindowIdCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#SystemUiCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="method#check#0;class#SystemUiCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#PasswordFieldCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="method#check#0;class#PasswordFieldCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="e#9909#9920#0" expanded="false" />
<element signature="method#FillPassword#0;class#AutoFillService#0" expanded="false" />
<element signature="method#fillDataInTextField#0;class#AutoFillService#0" expanded="false" />
<element signature="method#isSame#0;class#AutoFillService#0" expanded="false" />
<element signature="method#getCredentialsField#0;class#AutoFillService#0" expanded="false" />
<element signature="method#GetNodeOrChildren#0;class#AutoFillService#0" expanded="false" />
<element signature="method#ExistsNodeOrChildren#0;class#AutoFillService#0" expanded="false" />
<element signature="method#urlFromAddressFields#0;class#AutoFillService#0" expanded="false" />
<element signature="method#onInterrupt#0;class#AutoFillService#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -1511,6 +1528,8 @@
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
<pane id="Scope" /> <pane id="Scope" />
<pane id="AndroidView"> <pane id="AndroidView">
<subPane> <subPane>
@ -1526,8 +1545,6 @@
</PATH> </PATH>
</subPane> </subPane>
</pane> </pane>
<pane id="Scratches" />
<pane id="PackagesPane" />
</panes> </panes>
</component> </component>
<component name="PropertiesComponent"> <component name="PropertiesComponent">
@ -1718,25 +1735,25 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="-8" y="-8" width="1382" height="744" extended-state="6" /> <frame x="-8" y="-8" width="1382" height="744" extended-state="6" />
<editor active="false" /> <editor active="true" />
<layout> <layout>
<window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Palette&#9;" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Designer" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32879046" sideWeight="0.52723145" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32879046" sideWeight="0.5332829" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" /> <window_info id="Gradle Console" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" /> <window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32879046" sideWeight="0.47276855" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Messages" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.32879046" sideWeight="0.4667171" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Android" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32879046" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Android" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32879046" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32879046" sideWeight="0.4969743" order="6" side_tool="false" content_ui="tabs" /> <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.32879046" sideWeight="0.4969743" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Gradle" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" /> <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" /> <window_info id="Application Servers" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24886535" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" /> <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24886535" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" /> <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24962178" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" /> <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.24962178" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
@ -1796,6 +1813,23 @@
<caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" /> <caret line="0" column="0" selection-start-line="0" selection-start-column="0" selection-end-line="0" selection-end-column="0" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="docComment;class#AutoFillService#0" expanded="false" />
<element signature="method#onDestroy#0;class#AutoFillService#0" expanded="false" />
<element signature="class#NodeCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#WindowIdCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#SystemUiCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="method#check#0;class#SystemUiCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#PasswordFieldCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="method#check#0;class#PasswordFieldCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="e#9909#9920#0" expanded="false" />
<element signature="method#FillPassword#0;class#AutoFillService#0" expanded="false" />
<element signature="method#fillDataInTextField#0;class#AutoFillService#0" expanded="false" />
<element signature="method#isSame#0;class#AutoFillService#0" expanded="false" />
<element signature="method#getCredentialsField#0;class#AutoFillService#0" expanded="false" />
<element signature="method#GetNodeOrChildren#0;class#AutoFillService#0" expanded="false" />
<element signature="method#ExistsNodeOrChildren#0;class#AutoFillService#0" expanded="false" />
<element signature="method#urlFromAddressFields#0;class#AutoFillService#0" expanded="false" />
<element signature="method#onInterrupt#0;class#AutoFillService#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>
@ -2134,7 +2168,7 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings_autofill.xml"> <entry file="file://$PROJECT_DIR$/app/src/main/res/values/strings_autofill.xml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="-4.08">
<caret line="6" column="70" selection-start-line="6" selection-start-column="70" selection-end-line="6" selection-end-column="70" /> <caret line="6" column="70" selection-start-line="6" selection-start-column="70" selection-end-line="6" selection-end-column="70" />
<folding /> <folding />
</state> </state>
@ -2142,10 +2176,27 @@
</entry> </entry>
<entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java"> <entry file="file://$PROJECT_DIR$/app/src/main/java/keepass2android/autofill/AutoFillService.java">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state vertical-scroll-proportion="0.0"> <state vertical-scroll-proportion="0.5014663">
<caret line="149" column="44" selection-start-line="149" selection-start-column="44" selection-end-line="149" selection-end-column="44" /> <caret line="382" column="32" selection-start-line="382" selection-start-column="28" selection-end-line="382" selection-end-column="32" />
<folding> <folding>
<element signature="imports" expanded="true" /> <element signature="imports" expanded="true" />
<element signature="docComment;class#AutoFillService#0" expanded="false" />
<element signature="method#onDestroy#0;class#AutoFillService#0" expanded="false" />
<element signature="class#NodeCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#WindowIdCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#SystemUiCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="method#check#0;class#SystemUiCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="class#PasswordFieldCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="method#check#0;class#PasswordFieldCondition#0;class#AutoFillService#0" expanded="false" />
<element signature="e#9909#9920#0" expanded="false" />
<element signature="method#FillPassword#0;class#AutoFillService#0" expanded="false" />
<element signature="method#fillDataInTextField#0;class#AutoFillService#0" expanded="false" />
<element signature="method#isSame#0;class#AutoFillService#0" expanded="false" />
<element signature="method#getCredentialsField#0;class#AutoFillService#0" expanded="false" />
<element signature="method#GetNodeOrChildren#0;class#AutoFillService#0" expanded="false" />
<element signature="method#ExistsNodeOrChildren#0;class#AutoFillService#0" expanded="false" />
<element signature="method#urlFromAddressFields#0;class#AutoFillService#0" expanded="false" />
<element signature="method#onInterrupt#0;class#AutoFillService#0" expanded="false" />
</folding> </folding>
</state> </state>
</provider> </provider>

View File

@ -174,12 +174,6 @@ public class AutoFillService extends AccessibilityService {
else else
{ {
android.util.Log.d (_logTag, "Notif for " + url ); android.util.Log.d (_logTag, "Notif for " + url );
if (getLastReceivedCredentialsUser() != null)
{
android.util.Log.d (_logTag, getCredentialsField("URL"));
android.util.Log.d (_logTag, url);
}
AskFillPassword(url); AskFillPassword(url);
cancelNotification = false; cancelNotification = false;
} }
@ -196,13 +190,13 @@ public class AutoFillService extends AccessibilityService {
} }
catch (Exception e) catch (Exception e)
{ {
android.util.Log.e(_logTag, e.toString()); android.util.Log.e(_logTag, (e.toString() == null) ? "(null)" : e.toString() );
Intent intent = new Intent(Intent.ACTION_SEND); Intent intent = new Intent(Intent.ACTION_SEND);
intent.setType("message/rfc822"); intent.setType("message/rfc822");
String to = "crocoapps@gmail.com"; String to = "crocoapps@gmail.com";
intent.putExtra(Intent.EXTRA_EMAIL, new String[]{to}); intent.putExtra(Intent.EXTRA_EMAIL, new String[]{to});
intent.putExtra(Intent.EXTRA_SUBJECT, "Error report"); intent.putExtra(Intent.EXTRA_SUBJECT, "Error report 7d+");
intent.putExtra(Intent.EXTRA_TEXT, intent.putExtra(Intent.EXTRA_TEXT,
"Please send the following text as an error report to crocoapps@gmail.com. You may also add additional information about the workflow you tried to perform. This will help me improve the app. Thanks! \n"+e.toString() ); "Please send the following text as an error report to crocoapps@gmail.com. You may also add additional information about the workflow you tried to perform. This will help me improve the app. Thanks! \n"+e.toString() );
@ -247,7 +241,7 @@ public class AutoFillService extends AccessibilityService {
} }
catch (Exception e) catch (Exception e)
{ {
android.util.Log.d(_logTag, e.toString()); android.util.Log.d(_logTag, (e.toString() == null) ? "(null)" : e.toString());
targetName = packageName; targetName = packageName;
} }
} }