Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: strange potential NPE #568

Merged
merged 1 commit into from
Feb 3, 2022
Merged

fix: strange potential NPE #568

merged 1 commit into from
Feb 3, 2022

Conversation

midgleyc
Copy link
Member

@midgleyc midgleyc commented Feb 2, 2022

Occured when doing something in the relay browser while having the consumables pop-up open, once.

"strange" because I can't see how this could happen -- the null field is non-static and populated in the constructor, and you can't only have the filter field without the rest of it... I think?

Anyway, checking for null should make it no longer happen.

Unexpected error, debug log printed.
class java.lang.NullPointerException: Cannot load from object array because "this.this$0.filters" is null
java.lang.NullPointerException: Cannot load from object array because "this.this$0.filters" is null
	at net.sourceforge.kolmafia.swingui.panel.UseItemEnqueuePanel$ConsumableFilterField.isVisible(UseItemEnqueuePanel.java:709)
	at net.java.dev.spellcast.utilities.LockableListModel.updateSingleFilter(LockableListModel.java:828)
	at net.java.dev.spellcast.utilities.LockableListModel.updateFilter(LockableListModel.java:801)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.refreshConcoctionsNow(ConcoctionDatabase.java:1332)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.refreshConcoctions(ConcoctionDatabase.java:1179)
	at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1353)
	at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1105)
	at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:3252)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:208)
	at net.sourceforge.kolmafia.textui.RuntimeLibrary.visit_url(RuntimeLibrary.java:3027)
	at jdk.internal.reflect.GeneratedMethodAccessor174.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.sourceforge.kolmafia.textui.parsetree.LibraryFunction.execute(LibraryFunction.java:63)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:113)
	at net.sourceforge.kolmafia.textui.parsetree.Variable.getValue(Variable.java:42)
	at net.sourceforge.kolmafia.textui.parsetree.VariableReference.execute(VariableReference.java:41)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:68)
	at net.sourceforge.kolmafia.textui.parsetree.Variable.getValue(Variable.java:42)
	at net.sourceforge.kolmafia.textui.parsetree.VariableReference.execute(VariableReference.java:41)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:68)
	at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:423)
	at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:87)
	at net.sourceforge.kolmafia.textui.AshRuntime.executeScope(AshRuntime.java:254)
	at net.sourceforge.kolmafia.textui.AshRuntime.execute(AshRuntime.java:182)
	at net.sourceforge.kolmafia.KoLmafiaASH.getClientHTML(KoLmafiaASH.java:147)
	at net.sourceforge.kolmafia.KoLmafiaASH.getClientHTML(KoLmafiaASH.java:115)
	at net.sourceforge.kolmafia.KoLmafiaASH.getClientHTML(KoLmafiaASH.java:89)
	at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:3162)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:208)
	at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:455)
	at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:103)
	at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:82)

Unexpected error, debug log printed.
class java.lang.NullPointerException: Cannot load from object array because "this.this$0.filters" is null
java.lang.NullPointerException: Cannot load from object array because "this.this$0.filters" is null
	at net.sourceforge.kolmafia.swingui.panel.UseItemEnqueuePanel$ConsumableFilterField.isVisible(UseItemEnqueuePanel.java:709)
	at net.java.dev.spellcast.utilities.LockableListModel.updateSingleFilter(LockableListModel.java:828)
	at net.java.dev.spellcast.utilities.LockableListModel.updateFilter(LockableListModel.java:801)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.refreshConcoctionsNow(ConcoctionDatabase.java:1332)
	at net.sourceforge.kolmafia.persistence.ConcoctionDatabase.refreshConcoctions(ConcoctionDatabase.java:1179)
	at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1353)
	at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1105)
	at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:3252)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:208)
	at net.sourceforge.kolmafia.textui.RuntimeLibrary.visit_url(RuntimeLibrary.java:3027)
	at jdk.internal.reflect.GeneratedMethodAccessor174.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at net.sourceforge.kolmafia.textui.parsetree.LibraryFunction.execute(LibraryFunction.java:63)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:113)
	at net.sourceforge.kolmafia.textui.parsetree.Variable.getValue(Variable.java:42)
	at net.sourceforge.kolmafia.textui.parsetree.VariableReference.execute(VariableReference.java:41)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:68)
	at net.sourceforge.kolmafia.textui.parsetree.Variable.getValue(Variable.java:42)
	at net.sourceforge.kolmafia.textui.parsetree.VariableReference.execute(VariableReference.java:41)
	at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:68)
	at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:423)
	at net.sourceforge.kolmafia.textui.parsetree.UserDefinedFunction.execute(UserDefinedFunction.java:87)
	at net.sourceforge.kolmafia.textui.AshRuntime.executeScope(AshRuntime.java:254)
	at net.sourceforge.kolmafia.textui.AshRuntime.execute(AshRuntime.java:182)
	at net.sourceforge.kolmafia.KoLmafiaASH.getClientHTML(KoLmafiaASH.java:147)
	at net.sourceforge.kolmafia.KoLmafiaASH.getClientHTML(KoLmafiaASH.java:115)
	at net.sourceforge.kolmafia.KoLmafiaASH.getClientHTML(KoLmafiaASH.java:89)
	at net.sourceforge.kolmafia.request.RelayRequest.run(RelayRequest.java:3162)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:243)
	at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:208)
	at net.sourceforge.kolmafia.webui.RelayAgent.readServerResponse(RelayAgent.java:455)
	at net.sourceforge.kolmafia.webui.RelayAgent.performRelay(RelayAgent.java:103)
	at net.sourceforge.kolmafia.webui.RelayAgent.run(RelayAgent.java:82)
@midgleyc midgleyc requested a review from a team as a code owner February 2, 2022 23:14
@codecov
Copy link

codecov bot commented Feb 2, 2022

Codecov Report

Merging #568 (b889ebc) into main (20aa097) will increase coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##               main     #568   +/-   ##
=========================================
  Coverage     20.36%   20.37%           
- Complexity     8589     8596    +7     
=========================================
  Files           998      998           
  Lines        155995   155996    +1     
  Branches      34703    34704    +1     
=========================================
+ Hits          31775    31788   +13     
+ Misses       118297   118292    -5     
+ Partials       5923     5916    -7     
Impacted Files Coverage Δ
...ge/kolmafia/swingui/panel/UseItemEnqueuePanel.java 30.59% <0.00%> (-0.06%) ⬇️
src/net/sourceforge/kolmafia/KoLCharacter.java 37.14% <0.00%> (-0.13%) ⬇️
...sourceforge/kolmafia/session/InventoryManager.java 12.83% <0.00%> (-0.13%) ⬇️
src/net/sourceforge/kolmafia/Modifiers.java 57.10% <0.00%> (-0.06%) ⬇️
...net/sourceforge/kolmafia/request/FightRequest.java 23.65% <0.00%> (+0.05%) ⬆️
...ourceforge/kolmafia/utilities/StringUtilities.java 57.70% <0.00%> (+0.45%) ⬆️
src/net/sourceforge/kolmafia/KoLAdventure.java 15.53% <0.00%> (+0.46%) ⬆️
...rceforge/kolmafia/persistence/HolidayDatabase.java 34.59% <0.00%> (+0.71%) ⬆️
...forge/kolmafia/textui/langserver/FilesMonitor.java 78.20% <0.00%> (+1.28%) ⬆️
...e/kolmafia/persistence/AdventureSpentDatabase.java 16.66% <0.00%> (+1.96%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 20aa097...b889ebc. Read the comment docs.

@midgleyc midgleyc merged commit 5d5352f into kolmafia:main Feb 3, 2022
@midgleyc midgleyc deleted the npe-swing branch February 3, 2022 08:09
@midgleyc
Copy link
Member Author

midgleyc commented Feb 3, 2022

Think it was probably a race condition: if the code runs while the outer constructor is in progress, that would explain it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants