File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4350,7 +4350,15 @@ public int compare(int index1, int index2) {
43504350 double diffd = getDouble (a , column ) - getDouble (b , column );
43514351 return diffd == 0 ? 0 : (diffd < 0 ? -1 : 1 );
43524352 case STRING :
4353- return getString (a , column ).compareToIgnoreCase (getString (b , column ));
4353+ String string1 = getString (a , column );
4354+ if (string1 == null ) {
4355+ string1 = "" ; // avoid NPE when cells are left empty
4356+ }
4357+ String string2 = getString (b , column );
4358+ if (string2 == null ) {
4359+ string2 = "" ;
4360+ }
4361+ return string1 .compareToIgnoreCase (string2 );
43544362 case CATEGORY :
43554363 return getInt (a , column ) - getInt (b , column );
43564364 default :
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ X sort only uses the sign of the value
1010X more accurate than float, especially when using double and long values
1111X consistently implement write(PrintWriter) in the List and Dict classes
1212X add save(File) to the List and Dict classes
13+ X prevent Table.sort() from throwing NPE with empty cells
1314_ Dict.remove() should return value, not index (for consistency w/ others)
1415_ check again whether element 0,0 in a Table is working
1516_ https://github.com/processing/processing/issues/3011
You can’t perform that action at this time.
0 commit comments