NullPointerException on empty value in currency-converted amount
See original GitHub issueIf 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:
- Create a new account with a different currency than the one configured.
- Create a new transaction in some other account.
- Enter a description and an amount.
- Select the previously created account as transfer account. The transfer funds dialog will open.
- Select “Converted Amount”.
- Delete any value in the text box leaving it empty.
- Press “Save”.
- The application crashes.
Received as Crashlytics issue #205.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (1 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m working on a fix.
Fixed in develop branch.