Skip to content

Commit

Permalink
FIX: Not crashing if cell doesnt exist while rendering attire
Browse files Browse the repository at this point in the history
  • Loading branch information
afska committed Feb 8, 2017
1 parent 711306e commit 3063f62
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 5 additions & 2 deletions dist/components/gs-cell.html
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,13 @@
}
},
_updateStyles: function(_arg, _arg1, rowIndex, cellIndex, boom) {
var attire, cell, table, url;
var attire, cell, table, url, _ref;
table = _arg.base;
attire = _arg1.base;
cell = table[rowIndex][cellIndex];
cell = (_ref = table[rowIndex]) != null ? _ref[cellIndex] : void 0;
if (cell == null) {
return;
}
url = this.$.dresser.getImage(cell, attire);
this.customStyle["--stones-visibility"] = (url != null) || boom ? "hidden" : "visible";
if (url != null) {
Expand Down
2 changes: 1 addition & 1 deletion dist/gs-board.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gs-board",
"version": "1.2.1",
"version": "1.2.2",
"dependencies": {},
"devDependencies": {
"connect-livereload": "^0.4.0",
Expand Down
3 changes: 2 additions & 1 deletion src/components/gs-cell/script.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ Polymer
throw new Error("The coordinates are required") if not @cellIndex? or not @rowIndex?

_updateStyles: ({ base: table }, { base: attire }, rowIndex, cellIndex, boom) ->
cell = table[rowIndex][cellIndex]
cell = table[rowIndex]?[cellIndex]
return if not cell?
url = @$.dresser.getImage cell, attire

@customStyle["--stones-visibility"] = if url? or boom then "hidden" else "visible"
Expand Down

0 comments on commit 3063f62

Please # to comment.