List and Table: fixed possible NPE in unusual cases

This commit is contained in:
Karl Tauber
2020-08-26 12:16:11 +02:00
parent b208017117
commit 2f876d553f
2 changed files with 6 additions and 0 deletions

View File

@@ -126,6 +126,9 @@ public class FlatListUI
* or the application has to be changed to extend a FlatLaf renderer.
*/
private void toggleSelectionColors() {
if( list == null )
return;
if( FlatUIUtils.isPermanentFocusOwner( list ) ) {
if( list.getSelectionBackground() == selectionInactiveBackground )
list.setSelectionBackground( selectionBackground );

View File

@@ -188,6 +188,9 @@ public class FlatTableUI
* or the application has to be changed to extend a FlatLaf renderer.
*/
private void toggleSelectionColors() {
if( table == null )
return;
if( FlatUIUtils.isPermanentFocusOwner( table ) ) {
if( table.getSelectionBackground() == selectionInactiveBackground )
table.setSelectionBackground( selectionBackground );