A bit more error resilience for handling data received from the backend
See #339
This commit is contained in:
1 parent
3fc6b1e8cf
commit
d0cb119bb0
2 files changed
+2
-2
No files matched your search
@@ -194,7 +194,7 @@ function GcodeFilesViewModel(printerStateViewModel, loginStateViewModel) {
|
||||
var output = "<p><strong>Uploaded:</strong> " + formatDate(data["date"]) + "</p>";
|
||||
if (data["gcodeAnalysis"]) {
|
||||
output += "<p>";
|
||||
if (data["gcodeAnalysis"]["filament"]) {
|
||||
if (data["gcodeAnalysis"]["filament"] && typeof(data["gcodeAnalysis"]["filament"]) == "object") {
|
||||
var filament = data["gcodeAnalysis"]["filament"];
|
||||
if (_.keys(filament).length == 1) {
|
||||
output += "<strong>Filament:</strong> " + formatFilament(data["gcodeAnalysis"]["filament"]["tool" + 0]) + "<br>";
|
||||
|
||||
@@ -124,7 +124,7 @@ function PrinterStateViewModel(loginStateViewModel) {
|
||||
self.estimatedPrintTime(data.estimatedPrintTime);
|
||||
|
||||
var result = [];
|
||||
if (_.keys(data.filament).length > 0) {
|
||||
if (data.filament && typeof(data.filament) == "object" && _.keys(data.filament).length > 0) {
|
||||
var i = 0;
|
||||
do {
|
||||
var key = "tool" + i;
|
||||
|
||||
Reference in new issue
Block a user