music: check parent and siblings for null

This commit is contained in:
Max Weber
2019-10-24 13:29:05 -06:00
committed by Adam
parent a2166f1215
commit 66e7acd86f

View File

@@ -411,13 +411,21 @@ public class MusicPlugin extends Plugin
{ {
{ {
Widget handle = slider.getHandle(); Widget handle = slider.getHandle();
Widget[] siblings = handle.getParent().getChildren(); Widget parent = handle.getParent();
if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) if (parent == null)
{ {
continue; continue;
} }
siblings[slider.getTrack().getIndex()] = null; else
siblings[handle.getIndex()] = null; {
Widget[] siblings = parent.getChildren();
if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle)
{
continue;
}
siblings[slider.getTrack().getIndex()] = null;
siblings[handle.getIndex()] = null;
}
} }
Object[] init = icon.getOnLoadListener(); Object[] init = icon.getOnLoadListener();
@@ -444,11 +452,19 @@ public class MusicPlugin extends Plugin
Widget handle = slider.getHandle(); Widget handle = slider.getHandle();
if (handle != null) if (handle != null)
{ {
Widget[] siblings = handle.getParent().getChildren(); Widget parent = handle.getParent();
if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) if (parent == null)
{ {
handle = null; handle = null;
} }
else
{
Widget[] siblings = parent.getChildren();
if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle)
{
handle = null;
}
}
} }
if (handle == null) if (handle == null)
{ {