Skip to content

Commit 2ebd7ee

Browse files
committed
Fix crash printerProfiles not yet populated
Fix Kragrathea#158, fix Kragrathea#160
1 parent a121aae commit 2ebd7ee

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

octoprint_prettygcode/static/js/prettygcode.js

+12-3
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,13 @@ $(function () {
609609
}
610610
}
611611

612-
var bedVolume = undefined;
612+
var bedVolume = {
613+
depth: 0,
614+
formFactor: "",
615+
height: 0,
616+
origin: "",
617+
width: 0,
618+
};
613619
var viewInitialized = false;
614620
self.onTabChange = function (current, previous) {
615621

@@ -845,9 +851,12 @@ $(function () {
845851
}
846852

847853
function updateBedVolume() {
854+
var currentProfileData = self.printerProfiles.currentProfileData();
855+
if (!currentProfileData || !currentProfileData.volume) {
856+
return;
857+
}
848858

849-
//var volume = ko.mapping.toJS(self.printerProfiles.currentProfileData().volume);
850-
var volume = self.printerProfiles.currentProfileData().volume;
859+
var volume = currentProfileData.volume;
851860
//console.log([arguments.callee.name,volume]);
852861

853862
if (typeof volume.custom_box === "function") //check for custom bounds.

0 commit comments

Comments
 (0)