Commit a827d8f4 authored by Petri Hintukainen's avatar Petri Hintukainen

Fix possible null pointer dereference

Also log error if context does not match
parent fb43e1bd
......@@ -20,9 +20,10 @@ package javax.tv.graphics;
import java.awt.Container;
import javax.tv.xlet.XletContext;
import org.havi.ui.HScene;
import org.havi.ui.HSceneFactory;
import org.videolan.BDJXletContext;
public class TVContainer {
public static Container getRootContainer(XletContext context)
{
......@@ -30,7 +31,15 @@ public class TVContainer {
throw new NullPointerException();
}
HScene scene = HSceneFactory.getInstance().getDefaultHScene();
return scene;
if (!(context instanceof BDJXletContext) || (BDJXletContext)context != BDJXletContext.getCurrentContext()) {
org.videolan.Logger.getLogger(TVContainer.class.getName()).error("wrong context");
}
/* GEM: return instance of org.havi.ui.HScene or NULL */
HSceneFactory sf = HSceneFactory.getInstance();
if (sf != null) {
return sf.getDefaultHScene();
}
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment