NPE in ChartPanel.displayPopupMenu

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
JGoodwin
Posts: 27
Joined: Thu Sep 06, 2007 3:19 am
Location: Boston USA

NPE in ChartPanel.displayPopupMenu

Post by JGoodwin » Tue Jul 21, 2009 6:53 pm

This isn't very important but FWIW:

I got an NPE in ChartPanel.displayPopupMenu line 3018, JFreeChart 1.0.13.
The code there was:

Plot plot = this.chart.getPlot();

I got this because I dropped the mouse (literally: I'm wearing a wrist brace
and it's cramping my style) and must have clicked somehow during the
initialization of the chart.

It looks as if this.chart == null. Maybe there should be a check for
that and if true, then return without doing anything.

/jim

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: NPE in ChartPanel.displayPopupMenu

Post by david.gilbert » Wed Jul 22, 2009 9:15 am

Good catch. I committed a quick fix to Subversion for inclusion in the next release (1.0.14). But I need to think some more about how the popup menu should behave if the chart or plot is null.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked