In JavaAdapter.currentFactory() do not assume that there is always active Context available and fallback to ContextFactory.getGlobal() in that case.

This commit is contained in:
igor%mir2.org 2004-08-10 15:52:19 +00:00
Родитель 51adf8633f
Коммит 771b98446a
1 изменённых файлов: 10 добавлений и 1 удалений

Просмотреть файл

@ -609,7 +609,16 @@ public final class JavaAdapter implements IdFunctionCall
public static ContextFactory currentFactory()
{
return Context.getContext().getFactory();
ContextFactory factory;
Context cx = Context.getCurrentContext();
if (cx == null) {
// It can happen during instantiating of classes created
// with the class compiler in script-unaware application.
factory = ContextFactory.getGlobal();
} else {
factory = cx.getFactory();
}
return factory;
}
/**