Skip to content

Commit

Permalink
fix for statsheet error when renaming property type
Browse files Browse the repository at this point in the history
  • Loading branch information
cwisniew committed Sep 30, 2023
1 parent 043c840 commit 250bc95
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ private void accept() {
.forEach(
(o, n) -> {
campaign.renameTokenTypes(o, n);
System.out.println("Renaming " + o + " to " + n);
});
MapTool.getFrame().hideGlassPane();
copyUIToCampaign();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,6 @@ public void initTypeDeleteButton() {
var type = (String) getTokenTypeList().getSelectedValue();
if (type != null) {
JPanel renameToPanel = new JPanel();
// renameToPanel.setLayout(new BoxLayout(renameToPanel, BoxLayout.PAGE_AXIS));
JComboBox<String> types =
new JComboBox<>(
tokenTypeMap.keySet().stream()
Expand Down Expand Up @@ -332,6 +331,7 @@ public void initTokenTypeName() {
var oldName = (String) ttList.getSelectedValue();
var newName = field.getText();
tokenTypeMap.put(newName, tokenTypeMap.remove(oldName));
tokenTypeStatSheetMap.put(newName, tokenTypeStatSheetMap.remove(oldName));
ttList.setSelectedValue(newName, true);
updateExistingTokenTypes(oldName, newName);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,11 @@ public StatSheetProperties getTokenTypeDefaultStatSheet(String propertyType) {
*/
public void setTokenTypeDefaultStatSheet(
String propertyType, StatSheetProperties statSheetProperties) {
tokenTypeStatSheetMap.put(propertyType, statSheetProperties);
if (statSheetProperties == null) {
tokenTypeStatSheetMap.remove(propertyType);
} else {
tokenTypeStatSheetMap.put(propertyType, statSheetProperties);
}
}

public Map<String, SightType> getSightTypeMap() {
Expand Down

0 comments on commit 250bc95

Please sign in to comment.