Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/js/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ export function deepCopy(data) {
}

export function removeTrailingZeroes(value, maximumNumberDecimals=4) {
if (isNaN(value) || !isFinite(value)) {
if (value == null || isNaN(value) || !isFinite(value)) { // null/undefined slip past isNaN/isFinite
return value;
}
const split = value.toFixed(5).split(".")
Expand Down Expand Up @@ -1051,6 +1051,7 @@ export async function checkAndFixMas(mas, mkf=null) {
for (const op of mas.inputs.operatingPoints) {
if (op.excitationsPerWinding == null) continue;
for (const exc of op.excitationsPerWinding) {
if (exc == null) continue; // a just-added winding can leave a null excitation
for (const signal of ['current', 'voltage']) {
const harmonics = exc[signal]?.harmonics;
if (harmonics == null) continue;
Expand Down