Small CurveFitter bug




For a plugin I was writing, I used the CurveFitter ‘getSortedFitList()’ static method. This method gives a nullpointer however as the sortedFitList is not instantiated correctly before it is filled with the sorted names. The current code (I think?) of the CurveFitter class from GitHub reads:

public static String[] getSortedFitList() {
	if (sortedFitList == null) {
		String[] l = new String[fitList.length];
		for (int i=0; i<fitList.length; i++)
			sortedFitList[i] = fitList[sortedTypes[i]];        <---------- Nullpointer
		sortedFitList = l;
	return sortedFitList;

There is no pressing need to used the sorted list, as the normal fitList will do fine, but a bug is a bug. If the instantiation of the sortedFitList is done immediately instead of using the temporary ‘l’ Array, everything should be fine.

Best regards,


This bug is fixed in the latest ImageJ daily build (1.52c11).


Thanks Wayne!

For those interested in the technical details, this is the relevant commit:


Thanks Wayne for the quick fix.