diff --git a/ChangeLog.md b/ChangeLog.md
index 79b1a613..a5f43e51 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,5 +1,6 @@
#2.3.4
* Fix crash when removing the special effect from a module
+ * Ensure comparisons with saved stock ships work correctly
#2.3.3
* Remove unused blueprint when hitting reset
diff --git a/src/app/components/ComparisonTable.jsx b/src/app/components/ComparisonTable.jsx
index e8819d3c..0e72bd19 100644
--- a/src/app/components/ComparisonTable.jsx
+++ b/src/app/components/ComparisonTable.jsx
@@ -71,21 +71,22 @@ export default class ComparisonTable extends TranslatedComponent {
* @return {React.Component} Table row
*/
_buildRow(build, facets, formats, units) {
- let url = outfitURL(build.id, build.toString(), build.buildName);
- let cells = [
-
{build.name} | ,
- {build.buildName} |
- ];
+ if (build && build.id && build.buildName) {
+ let url = outfitURL(build.id, build.toString(), build.buildName);
+ let cells = [
+ {build.name} | ,
+ {build.buildName} |
+ ];
- for (let f of facets) {
- if (f.active) {
- for (let p of f.props) {
- cells.push({formats[f.fmt](build[p])}{f.unit ? units[f.unit] : null} | );
+ for (let f of facets) {
+ if (f.active) {
+ for (let p of f.props) {
+ cells.push({formats[f.fmt](build[p])}{f.unit ? units[f.unit] : null} | );
+ }
}
}
+ return {cells}
;
}
-
- return {cells}
;
}
/**
diff --git a/src/app/pages/ComparisonPage.jsx b/src/app/pages/ComparisonPage.jsx
index b258247e..3b351691 100644
--- a/src/app/pages/ComparisonPage.jsx
+++ b/src/app/pages/ComparisonPage.jsx
@@ -81,7 +81,9 @@ export default class ComparisonPage extends Page {
newName = name;
for (let shipId in allBuilds) {
for (let buildName in allBuilds[shipId]) {
- builds.push(this._createBuild(shipId, buildName, allBuilds[shipId][buildName]));
+ if (buildName && allBuilds[shipId][buildName]) {
+ builds.push(this._createBuild(shipId, buildName, allBuilds[shipId][buildName]));
+ }
}
}
} else {
diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx
index 358443f3..5f8d14af 100644
--- a/src/app/pages/OutfittingPage.jsx
+++ b/src/app/pages/OutfittingPage.jsx
@@ -308,7 +308,10 @@ export default class OutfittingPage extends Page {
* Save the current build
*/
_saveBuild() {
- const { code, buildName, newBuildName, shipId } = this.state;
+ const { ship, buildName, newBuildName, shipId } = this.state;
+
+ // If this is a stock ship the code won't be set, so ensure that we have it
+ const code = this.state.code || ship.toString();
Persist.saveBuild(shipId, newBuildName, code);
this._updateRoute(shipId, newBuildName, code);
diff --git a/src/app/shipyard/Ship.js b/src/app/shipyard/Ship.js
index 99dcd23d..902ba096 100755
--- a/src/app/shipyard/Ship.js
+++ b/src/app/shipyard/Ship.js
@@ -707,6 +707,11 @@ export default class Ship {
* @return {this} The current ship instance for chaining
*/
buildFrom(serializedString) {
+ if (!serializedString) {
+ // Empty serialized string; nothing to do
+ return this;
+ }
+
let standard = new Array(this.standard.length),
hardpoints = new Array(this.hardpoints.length),
internal = new Array(this.internal.length),