Skip to content

Commit d928270

Browse files
xesscorpxesscorp
and
xesscorp
authored
Caught exception so grouped SVG elements without a pin ID would not t… (#96)
* Caught exception so grouped SVG elements without a pin ID would not terminate the processing of a skin file. * Removed unnecessary semicolon for nop statement. * Indented variable declarations. Co-authored-by: xesscorp <[email protected]>
1 parent 10177f9 commit d928270

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

built/Skin.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ var Skin;
88
Skin.skin = null;
99
function getPortsWithPrefix(template, prefix) {
1010
var ports = _.filter(template, function (e) {
11-
if (e instanceof Array && e[0] === 'g') {
12-
return e[1]['s:pid'].startsWith(prefix);
11+
try {
12+
if (e instanceof Array && e[0] === 'g') {
13+
return e[1]['s:pid'].startsWith(prefix);
14+
}
15+
}
16+
catch (exception) {
17+
// Do nothing if the SVG group doesn't have a pin id.
1318
}
1419
});
1520
return ports;

lib/Skin.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
import onml = require('onml');
23
import _ = require('lodash');
34
import { ElkModel } from './elkGraph';
@@ -8,8 +9,12 @@ export namespace Skin {
89

910
export function getPortsWithPrefix(template: any[], prefix: string) {
1011
const ports = _.filter(template, (e) => {
11-
if (e instanceof Array && e[0] === 'g') {
12-
return e[1]['s:pid'].startsWith(prefix);
12+
try {
13+
if (e instanceof Array && e[0] === 'g') {
14+
return e[1]['s:pid'].startsWith(prefix);
15+
}
16+
} catch (exception) {
17+
// Do nothing if the SVG group doesn't have a pin id.
1318
}
1419
});
1520
return ports;

tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"compilerOptions": {
33
"outDir": "./built",
44
"allowJs": true,
5-
"lib": [ "es6" ],
5+
"lib": [ "es6", "dom" ],
66
"target": "es5"
77
},
88
"include": [

0 commit comments

Comments
 (0)