Split safely
This commit is contained in:
1 parent
33cb3df1a1
commit
955f328d1b
2 files changed
+4
-2
No files matched your search
@@ -26,7 +26,8 @@ class CostumeLibrary extends React.PureComponent {
|
||||
]);
|
||||
}
|
||||
handleItemSelected (item) {
|
||||
const type = item.md5.split('.')[1];
|
||||
const split = item.md5.split('.');
|
||||
const type = split.length > 1 ? split[1] : null;
|
||||
const rotationCenterX = type === 'svg' ? item.info[0] : item.info[0] / 2;
|
||||
const rotationCenterY = type === 'svg' ? item.info[1] : item.info[1] / 2;
|
||||
const vmCostume = {
|
||||
|
||||
@@ -161,7 +161,8 @@ class CostumeTab extends React.Component {
|
||||
}
|
||||
handleSurpriseCostume () {
|
||||
const item = costumeLibraryContent[Math.floor(Math.random() * costumeLibraryContent.length)];
|
||||
const type = item.md5.split('.')[1];
|
||||
const split = item.md5.split('.');
|
||||
const type = split.length > 1 ? split[1] : null;
|
||||
const rotationCenterX = type === 'svg' ? item.info[0] : item.info[0] / 2;
|
||||
const rotationCenterY = type === 'svg' ? item.info[1] : item.info[1] / 2;
|
||||
const vmCostume = {
|
||||
|
||||
Reference in new issue
Block a user