benfry / processing4

Processing 4.x releases for Java 17
https://processing.org
Other
1.35k stars 237 forks source link

`Cannot invoke "processing.app.SketchCode.isModified()" because "this.current" is null` #719

Open catem-code opened 1 year ago

catem-code commented 1 year ago

java. lang. NullPointerException: Cannot invoke "processing.app.SketchCode.isModified ()" because

"this.current" is null

at processing.app. Sketch. setModified (Sketch. java: 760) at processing. mode. java. JavaEditor. (JavaEditor. java: 119) at processing. mode. java. JavaMode. createEditor (JavaMode. java: 44) at processing. app. Base. handleOpenInternal (Base. java: 1613) at processing. app. Base. handleOpen (Base. java: 1482) at processing. app. Base. handleOpenPrompt (Base. java: 1178) at processing.app.u. Editor. lambda$buildFileMenus4 (Editor.¡ava:662) at java. desktop/javax. swing. AbstractButton. fireActionPerformed (AbstractButton. java: 1972) at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2313) at java.desktop/javax.swing. DefaultButtonModel.fireActionPerformed(DevaultButtonModel.ava:405) at java.desktop/javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:262) at java.desktop/javax.swing.AbstractButton.doClick(AbstractButton.java:374) at java.desktop/javax.swing.pilaf.basic.Bas ricMenuItemUI.doClick(BasicMenuItemUI.java:1028) at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1072) at java.desktop/java.awt. Component. processMouseEvent (Component. java: 6626) at java. desktop/javax. swing. JComponent. processMouseEvent (JComponent. java: 3389) at java.desktop/java.awt. Component. processEvent (Component. java: 6391) java.desktop/java.awt.Container.processEvent(Container. java:2266)

at java.desktop/java awt. Component. dispatchEventImpl (Component java: 5001)

java.desktop/java.

awt. Container.dispatchEventImpl (Container java: 2324)

at java.desktop/java. awt. Component. dispatchEvent (Component. java: 4833) at java. desktop/java.awt. LightweightDispatcher.retargetMouseEvent(Container.java: 4948) at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575) at java.desktop/java.awt

LightweightDispatcher _dispatchEvent (Container: java: 4516)

at java.desktop/java

Container. dispatchEventImpl(Container java:2310)

at java.desktop/java

Ewindow

• dispatchEventIm pl (window. java:2780)

java.desktop/java.aw

(Component

L.ja va: 4833)

at java.desktop/java

chEventImpl(EventQueue.java: 773

CHET

java.desktop/java at java.desktop/java.awt at java.base/java.securit

a: 399

at java.base/java, security. ProtectionDomainsJavase at java.base/java. security. ProtectionDomainsJav

ege (ProtectionDomain. java: 86)

ege (ProtectionDomain. java: 97)

at java.desktop/java. awt. EventQueue$5 run (EventQueue. java: 7. at java.desktop/java.awt. EventQueue$5. run (EventQueue. java: 742 at java.base/java.secur

Arcasstonrrores

at lava.base java.secur

tectionDomain$J.

ProtectionDomain, ¡ava: 86)

at lava.desktop/Java.awl

:203

at lava.desktop/java.awt.Eventospatc at java.desktop/java.awt. EventDispatchThread.pumpEventsForFilter(EventDispatchThread at java. desktop/java.awt. EventDispatchThread.pumpEventsForHierarchy (EventDispatchT at java.desktop/java. awt. EventDispatchThread.pumpEvents (EventDispatchThread. at java.desktop/java.avt.EventDispatchThread.pumpEvents(EventDispatchThread.

Q

janebeta7 commented 1 year ago

The same error Here.

SableRaf commented 1 year ago

Hello @catem-code and @janebeta7,

Thank you for bringing this issue to our attention. To better understand and troubleshoot the error, could you please provide more context?

These details would be really helpful for us to investigate further.

benfry commented 1 year ago

It looks like this happened when opening a sketch, so a couple more questions:

janebeta7 commented 1 year ago

It looks like this happened when opening a sketch, so a couple more questions:

* Was it actually a sketch folder? (This error could happen if the editor isn't able to find any source code in the folder.)

* Does it happen consistently with that folder? (If so, can you share it?)

I solved the problem. The sketch.properties file did not exist so I copied this file from another sketch and it worked.

benfry commented 1 year ago

Were you using p5.js Mode or something like that?

janebeta7 commented 1 year ago

Were you using p5.js Mode or something like that?

Yes, p5.js

benfry commented 1 year ago

Ok, opening a new issue over here: https://github.com/fathominfo/processing-p5js-mode/issues/30

Is there anything you can tell me about how the sketch was made? Did you create it, close it, and then re-open it? Was it immediate or after several days? Has it been re-saved multiple times? I'm just trying to figure out how the sketch.properties file went missing so I can fix it.

seanhoughton commented 9 months ago

I got the same thing when using the Python mode in Processing 4.3. I have just installed Processing so not much baggage is needed to reproduce it:

  1. Download Processing
  2. Install Python mode
  3. Switch to python mode
  4. Save your sketch (I saved mine to a non-default path)
  5. Restart Processing
  6. Try to open the saved sketch
  7. Get NPE mentioned in this thread

Note: it does not happen if you save in the default location.

janebeta7 commented 9 months ago

Ok, opening a new issue over here: fathominfo/processing-p5js-mode#30

Is there anything you can tell me about how the sketch was made? Did you create it, close it, and then re-open it? Was it immediate or after several days? Has it been re-saved multiple times? I'm just trying to figure out how the sketch.properties file went missing so I can fix it.

Hi Ben, unfortunately I can't give you much information, because I'm not aware of when the file disappeared, perhaps in a poorly executed folder copy.