Unfolding null pointer exception with OpenStreetMap - DEAD POST -
in
Contributed Library Questions
•
1 year ago
This post becames outdated please
read this instead
This sketch runs fine, but suddenly, it freezes throwing this error:
java.lang.NullPointerException
at processing.core.PGraphics.image(PGraphics.java:2829)
at de.fhpotsdam.unfolding.mapdisplay.ProcessingMapDisplay.draw(Unknown Source)
at de.fhpotsdam.unfolding.UnfoldingMap.draw(Unknown Source)
at studying_stream_05E.draw(studying_stream_05E.java:145)
at processing.core.PApplet.handleDraw(PApplet.java:1631)
at processing.core.PApplet.run(PApplet.java:1530)
at java.lang.Thread.run(Thread.java:680)
The offscreen renderer has already been set. Maybe you are calling beginDraw() again before endDraw()?
I think it happens when zooming and panning around, but not sure.
With default provider i haven't seen this. It
It happens with default provider Also . I think, it is related to threads after all. BUt i don't know how to handle this. SEE MINE REPLY
Do you think it is related to the provider? Is there a way to avoid this error to stops the sketch? I tried a basic try/catch but is freezing anyway. When error occurs the highlighted line is
map.draw();
I isolated the unfolding code to paste it below. The happens erratically... If i find any thing new i'll post here again.
- import processing.opengl.*;
-
- /// unfolding imports
- import codeanticode.glgraphics.*;
- import de.fhpotsdam.unfolding.*;
- import de.fhpotsdam.unfolding.geo.*;
- import de.fhpotsdam.unfolding.utils.*;
- import de.fhpotsdam.unfolding.providers.OpenStreetMap;
-
-
-
- /// Map
- de.fhpotsdam.unfolding.UnfoldingMap map;
-
-
- void setup() {
- size(1400, 800, GLConstants.GLGRAPHICS);
- smooth();
- map = new UnfoldingMap(this, new OpenStreetMap.CloudmadeProvider("my key here...", 67367));
- map.zoomToLevel(2);
- MapUtils.createDefaultEventDispatcher(this, map);
- }
-
- void draw() {
-
- try
- {
- map.draw();
- }catch (Exception e)
- {
- e.printStackTrace();
- }
- }/// eof draw
EDIT: it seems to be not related to panning and zoom. Maybe some thread related issue? I'm using twitter listener which is a separated thread. ??
1