question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullPointerException on empty value in currency-converted amount

See original GitHub issue

If no value is entered in the converted amount text box in the “Transfer funds” dialog, the application crashes with a NullPointerException:

java.lang.NullPointerException: Attempt to invoke virtual method 'java.math.BigDecimal java.math.BigDecimal.setScale(int, java.math.RoundingMode)' on a null object reference
  at org.gnucash.android.model.Money.setAmount(Money.java:333)
  at org.gnucash.android.model.Money.<init>(Money.java:116)
  at org.gnucash.android.ui.transaction.dialog.TransferFundsDialogFragment.transferFunds(TransferFundsDialogFragment.java:226)
  at org.gnucash.android.ui.transaction.dialog.TransferFundsDialogFragment.access$100(TransferFundsDialogFragment.java:60)
  at org.gnucash.android.ui.transaction.dialog.TransferFundsDialogFragment$5.onClick(TransferFundsDialogFragment.java:180)
  at android.view.View.performClick(View.java:4802)
  at android.view.View$PerformClick.run(View.java:20101)
  at android.os.Handler.handleCallback(Handler.java:810)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:189)
  at android.app.ActivityThread.main(ActivityThread.java:5532)
  at java.lang.reflect.Method.invoke(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:372)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:950)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:745)

Steps to reproduce:

  1. Create a new account with a different currency than the one configured.
  2. Create a new transaction in some other account.
  3. Enter a description and an amount.
  4. Select the previously created account as transfer account. The transfer funds dialog will open.
  5. Select “Converted Amount”.
  6. Delete any value in the text box leaving it empty.
  7. Press “Save”.
  8. The application crashes.

Received as Crashlytics issue #205.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
rivaldi8commented, May 23, 2016

I’m working on a fix.

0reactions
rivaldi8commented, May 30, 2016

Fixed in develop branch.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Exception in thread "main" java.lang.NullPointerException ...
You need to call setExchangeRates ; otherwise, the double[] will be null. CurrencyConverter cc = new CurrencyConverter(); { cc.
Read more >
How to Fix and Avoid NullPointerException in Java - Rollbar
NullPointerException in Java occurs when a variable is accessed which is not pointing to any object and refers to nothing or null.
Read more >
Null Pointer Exception In Java - GeeksforGeeks
NullPointerException is thrown when program attempts to use an object reference that has the null value. These can be: Invoking a method from...
Read more >
What Is NullPointerException In Java & How To Avoid It
NullPointerException in Java is a runtime exception. Java assigns a special null value to an object reference. When a program tries to use ......
Read more >
NullPointerException (Java Platform SE 7 ) - Oracle Help Center
Thrown when an application attempts to use null in a case where an object is required. These include: Calling the instance method of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found