Skip to content

Commit

Permalink
fix: Prevent exception on saving a change in the 'Formulas' (#2121)
Browse files Browse the repository at this point in the history
Co-authored-by: Sebastian Reddig <[email protected]>
  • Loading branch information
sgcr and sgcr authored Aug 18, 2024
1 parent a4e7603 commit d01dcbb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 11 deletions.
19 changes: 11 additions & 8 deletions src/main/java/core/option/FormelPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ final class FormelPanel extends ImagePanel implements ActionListener, ItemListen
private SliderPanel m_jpTorwart;
private SliderPanel m_jpVerteidigung;
private SliderPanel m_jpNORMALISATIONFACTOR;
private boolean isStored;

//~ Constructors -------------------------------------------------------------------------------

Expand Down Expand Up @@ -160,6 +161,7 @@ public void refresh() {
m_jpVerteidigung.setValue(factorObject.getDEfactor());
m_jpStandard.setValue(factorObject.getSPfactor());
m_jpNORMALISATIONFACTOR.setValue(factorObject.getNormalizationFactor());
isStored = factorObject.isStored();

m_jpSpielaufbau.addChangeListener(this);
m_jpFluegelspiel.addChangeListener(this);
Expand All @@ -177,14 +179,15 @@ public void stateChanged(javax.swing.event.ChangeEvent changeEvent) {
final FormulaFactors factors = FormulaFactors.instance();
final FactorObject factorObject = new FactorObject((byte) (((CBItem) Objects.requireNonNull(m_jcbPosition
.getSelectedItem())).getId()),
m_jpTorwart.getValue(),
m_jpSpielaufbau.getValue(),
m_jpPasspiel.getValue(),
m_jpFluegelspiel.getValue(),
m_jpVerteidigung.getValue(),
m_jpTorschuss.getValue(),
m_jpStandard.getValue(),
m_jpNORMALISATIONFACTOR.getValue());
m_jpTorwart.getValue(),
m_jpSpielaufbau.getValue(),
m_jpPasspiel.getValue(),
m_jpFluegelspiel.getValue(),
m_jpVerteidigung.getValue(),
m_jpTorschuss.getValue(),
m_jpStandard.getValue(),
m_jpNORMALISATIONFACTOR.getValue());
factorObject.setIsStored(isStored);

factors.setPositionFactor(factorObject.getPosition(),factorObject);
OptionManager.instance().setReInitNeeded();
Expand Down
9 changes: 6 additions & 3 deletions src/main/resources/release_notes.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@


## Highlights
* Calculation of the tsi sub by approximating the tsi formula (#235)

* Calculation of the tsi sub by approximating the tsi formula (#235)

## [Detailed Changelog](https://github.com/ho-dev/HattrickOrganizer/issues?q=milestone%3A9.0)

### Database

* Increase match report column size (#2065)

### Squad

* Calculation of the tsi sub by approximating the tsi formula (#235)

### Team Analyzer
Expand All @@ -27,12 +27,15 @@
### Training

### International Friendlies

* Fix database error on match reload (#2063)

### Youth

### Option setting

* Fix: `Preferences/Formulas`: When changing anything and saving it, the application does not crash anymore during quit.

### Misc

## Translations
Expand Down

0 comments on commit d01dcbb

Please sign in to comment.