Skip to content
This repository has been archived by the owner on Jul 24, 2023. It is now read-only.

Crash switching variables on set statements (NPE) #746

Open
plattysoft opened this issue Sep 20, 2018 · 0 comments
Open

Crash switching variables on set statements (NPE) #746

plattysoft opened this issue Sep 20, 2018 · 0 comments

Comments

@plattysoft
Copy link

plattysoft commented Sep 20, 2018

I have seen this crash at least 3 times and it is quite replicable, but not 100%

Steps to replicate:

  • Add 2 set {variable} to {value} pieces
  • Swap the variable name of one
  • Swap the variable name of the other

Not sure if there needs to be more than 3 variables, if the other pieces on the workspace are relevant, or if they need to be connected, but each time I've tried to build a relatively complex program involving 3 variables it has crashed at some point.

Something like this is what I was trying to write:

position = 0
increasing = false

if (increasing) {
   position = position +1
   if (position == max) {
      increasing = false
   }
}
else {
   position = position -1
   if (position == min) {
      increasing = true
   }
}

This is the stack trace I am getting:

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.google.blockly.android.control.WorkspaceStats$VariableInfoImpl.removeField(com.google.blockly.model.FieldVariable)' on a null object reference
at com.google.blockly.android.control.WorkspaceStats$1.onValueChanged(WorkspaceStats.java:52)
at com.google.blockly.model.Field$1.run(Field.java:240)
at com.google.blockly.model.Block.runAsPossibleEventGroup(Block.java:1318)
at com.google.blockly.model.Field.runAsPossibleEventGroup(Field.java:252)
at com.google.blockly.model.Field.fireValueChanged(Field.java:232)
at com.google.blockly.model.FieldVariable.setVariable(FieldVariable.java:74)
at com.google.blockly.android.ui.fieldview.BasicFieldVariableView.setSelection(BasicFieldVariableView.java:116)
at android.widget.Spinner$DropdownPopup$1.onItemClick(Spinner.java:1186)
at android.widget.AdapterView.performItemClick(AdapterView.java:318)
at android.widget.AbsListView.performItemClick(AbsListView.java:1158)
at android.widget.AbsListView$PerformClick.run(AbsListView.java:3127)
at android.widget.AbsListView$3.run(AbsListView.java:4042)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)
01-01 00:37:43.678 3437-3437/com.plattysoft.blocklyrainbowhat I/Process: Sending signal. PID: 3437 SIG: 9

@plattysoft plattysoft changed the title Crash switching variables on set statements Crash switching variables on set statements Sep 20, 2018
@plattysoft plattysoft changed the title Crash switching variables on set statements Crash switching variables on set statements (NPE) Sep 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants