Prevent rendering sound editor for non-existant sounds
This commit is contained in:
1 parent
c9565f01ca
commit
a3ad670108
1 file changed
+2
-2
@@ -38,7 +38,7 @@ class SoundTab extends React.Component {
|
||||
const target = editingTarget && sprites[editingTarget] ? sprites[editingTarget] : stage;
|
||||
|
||||
if (target && target.sounds && this.state.selectedSoundIndex > target.sounds.length - 1) {
|
||||
this.setState({selectedSoundIndex: target.sounds.length - 1});
|
||||
this.setState({selectedSoundIndex: Math.max(target.sounds.length - 1, 0)});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class SoundTab extends React.Component {
|
||||
onDeleteClick={this.handleDeleteSound}
|
||||
onItemClick={this.handleSelectSound}
|
||||
>
|
||||
{target.sounds ? (
|
||||
{target.sounds && target.sounds.length > 0 ? (
|
||||
<SoundEditor soundIndex={this.state.selectedSoundIndex} />
|
||||
) : null}
|
||||
{this.props.soundRecorderVisible ? (
|
||||
|
||||
Reference in new issue
Block a user