Skip to content

Commit a8dd6f7

Browse files
committed
Fix crash caused by transfer account spinner
Sometimes the view received in onItemSelected is null, causing a NullPointerException. I couldn't reproduce the crash, although the fix seems evident. Fixes http://crashes.to/s/93f65e0f4e6
1 parent 3c26b27 commit a8dd6f7

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

app/src/main/java/org/gnucash/android/ui/transaction/TransactionFormFragment.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,11 @@ public void onActivityCreated(Bundle savedInstanceState) {
322322

323323
@Override
324324
public void onItemSelected(AdapterView<?> adapterView, View view, int position, long id) {
325-
// Remove the favorite star from the view to avoid visual clutter.
326-
TextView qualifiedAccountName = (TextView) view;
327-
qualifiedAccountName.setCompoundDrawablesWithIntrinsicBounds(0,0,0,0);
325+
if (view != null) {
326+
// Remove the favorite star from the view to avoid visual clutter.
327+
TextView qualifiedAccountName = (TextView) view;
328+
qualifiedAccountName.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
329+
}
328330

329331
if (mSplitsList.size() == 2) { //when handling simple transfer to one account
330332
for (Split split : mSplitsList) {

0 commit comments

Comments
 (0)