Skip to content

Commit

Permalink
#543 Fix NPE when "show selected thread" (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
otrebski committed Sep 11, 2018
1 parent 7ceddb7 commit 28dc627
Showing 1 changed file with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
/*******************************************************************************
* Copyright 2011 Krzysztof Otrebski
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package pl.otros.logview.accept;

import com.google.common.base.Joiner;
import pl.otros.logview.api.gui.LogDataTableModel;
import pl.otros.logview.api.model.LogData;

import javax.swing.*;
import java.util.Optional;
import java.util.Set;
import java.util.TreeSet;

Expand Down Expand Up @@ -49,7 +35,7 @@ protected void updateAfterSelection() {
int[] selectedRows = jTable.getSelectedRows();
for (int i : selectedRows) {
LogData logData = dataTableModel.getLogData(jTable.convertRowIndexToModel(i));
threads.add(logData.getThread());
threads.add(Optional.ofNullable(logData.getThread()).orElse("--"));
}

description = threads.size() + " threads: " + Joiner.on(", ").join(threads);
Expand Down

0 comments on commit 28dc627

Please sign in to comment.