X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=DanUtil.pde;fp=DanUtil.pde;h=e475059b3082937da86d867acd9ed2659cfd770d;hb=ee1206f686f25042133c6458f2ccc59549382a7d;hp=859b5187b709c80858fabd34b6bb51a2ac3aadfc;hpb=41f26e8f9938e1924ab8274021c1efe120dcc434;p=SugarCubes.git diff --git a/DanUtil.pde b/DanUtil.pde index 859b518..e475059 100644 --- a/DanUtil.pde +++ b/DanUtil.pde @@ -227,7 +227,8 @@ public class DPat extends SCPattern void StartRun(double deltaMs) { } color CalcPoint(xyz p) { return lx.hsb(0,0,0); } boolean IsActive() { return this == DG.CurPat; } - boolean IsFocused() { return this == midiEngine.getFocusedDeck().getActivePattern(); } + boolean IsFocused() { return midiEngine != null && midiEngine.getFocusedDeck() != null && + this == midiEngine.getFocusedDeck().getActivePattern(); } void onInactive() { UpdateState(); } void onActive () { UpdateState(); StartPattern(); } void UpdateState() { if (IsFocused() != IsActive()) { if (IsFocused()) DG.Activate(this); else DG.Deactivate(this); } }