Skip to content

Commit

Permalink
Fix pendant UI null pointer exceptions. Closes #248
Browse files Browse the repository at this point in the history
  • Loading branch information
winder committed Feb 17, 2016
1 parent ea6c13a commit eabb095
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions src/com/willwinder/universalgcodesender/model/GUIBackend.java
Expand Up @@ -251,21 +251,28 @@ public void applySettings(Settings settings) throws Exception {
@Override
public void updateSystemState(SystemStateBean systemStateBean) {
logger.log(Level.INFO, "Getting system state 'updateSystemState'");
systemStateBean.setFileName(gcodeFile.getAbsolutePath());
if (gcodeFile != null)
systemStateBean.setFileName(gcodeFile.getAbsolutePath());
systemStateBean.setLatestComment(lastComment);
systemStateBean.setActiveState(activeState);
systemStateBean.setControlState(controlState);
systemStateBean.setDuration(String.valueOf(this.getSendDuration()));
systemStateBean.setEstimatedTimeRemaining(String.valueOf(this.getSendRemainingDuration()));
systemStateBean.setMachineX(Utils.formatter.format(this.machineCoord.getX()));
systemStateBean.setMachineY(Utils.formatter.format(this.machineCoord.getY()));
systemStateBean.setMachineZ(Utils.formatter.format(this.machineCoord.getZ()));
systemStateBean.setRemainingRows(String.valueOf(this.getNumRemainingRows()));
systemStateBean.setRowsInFile(String.valueOf(this.getNumRows()));
systemStateBean.setSentRows(String.valueOf(this.getNumSentRows()));
systemStateBean.setWorkX(Utils.formatter.format(this.workCoord.getX()));
systemStateBean.setWorkY(Utils.formatter.format(this.workCoord.getY()));
systemStateBean.setWorkZ(Utils.formatter.format(this.workCoord.getZ()));
if (this.machineCoord != null) {
systemStateBean.setMachineX(Utils.formatter.format(this.machineCoord.getX()));
systemStateBean.setMachineY(Utils.formatter.format(this.machineCoord.getY()));
systemStateBean.setMachineZ(Utils.formatter.format(this.machineCoord.getZ()));
}
if (this.controller != null) {
systemStateBean.setRemainingRows(String.valueOf(this.getNumRemainingRows()));
systemStateBean.setRowsInFile(String.valueOf(this.getNumRows()));
systemStateBean.setSentRows(String.valueOf(this.getNumSentRows()));
systemStateBean.setDuration(String.valueOf(this.getSendDuration()));
systemStateBean.setEstimatedTimeRemaining(String.valueOf(this.getSendRemainingDuration()));
}
if (this.workCoord != null) {
systemStateBean.setWorkX(Utils.formatter.format(this.workCoord.getX()));
systemStateBean.setWorkY(Utils.formatter.format(this.workCoord.getY()));
systemStateBean.setWorkZ(Utils.formatter.format(this.workCoord.getZ()));
}
systemStateBean.setSendButtonText(openCloseButtonText);
systemStateBean.setSendButtonEnabled(openCloseButtonEnabled);
systemStateBean.setPauseResumeButtonText(pauseButtonText);
Expand Down

0 comments on commit eabb095

Please sign in to comment.