Happens only when script is run in background.

Happens only when script is run in background.

java.lang.NullPointerException: Attempt to invoke virtual method ‘net.pierrox.lightning_launcher.views.ItemLayout net.pierrox.lightning_launcher.views.u.m()’ on a null object reference

at net.pierrox.lightning_launcher.script.api.Folder.getContainer(Folder.java:101)

at java.lang.reflect.Method.invoke(Native Method)

at org.mozilla.javascript.bd.a(MemberBox.java:126)

at org.mozilla.javascript.bz.call(NativeJavaMethod.java:225)

at org.mozilla.javascript.ao.a(Interpreter.java:1473)

at org.mozilla.javascript.ao.a(Interpreter.java:815)

at org.mozilla.javascript.an.call(InterpretedFunction.java:109)

at org.mozilla.javascript.ContextFactory.a(ContextFactory.java:394)

at org.mozilla.javascript.dn.a(ScriptRuntime.java:3091)

at org.mozilla.javascript.l.a(Context.java:1172)

at org.mozilla.javascript.l.a(Context.java:1139)

at net.pierrox.lightning_launcher.script.b.a(ScriptExecutor.java:602)

at net.pierrox.lightning_launcher.script.b.a(ScriptExecutor.java:536)

at net.pierrox.lightning_launcher.util.FireReceiver.onReceive(FireReceiver.java:32)

at android.app.ActivityThread.handleReceiver(ActivityThread.java:2725)

at android.app.ActivityThread.-wrap14(ActivityThread.java)

at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1421)

at android.os.Handler.dispatchMessage(Handler.java:102)

at android.os.Looper.loop(Looper.java:148)

at android.app.ActivityThread.main(ActivityThread.java:5417)

at java.lang.reflect.Method.invoke(Native Method)

at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:114)

]]>

17 Commentsto Happens only when script is run in background.

  1. Anonymous says:

    < ![CDATA[

    Using getContainer() on a folder in a script run in background seems to work with a basic use case. Does your script modify the folder previously? Could you share more on the context?

    ]]>

  2. Anonymous says:

    < ![CDATA[

    Script is trying to enumerate all containers in a tree structure. Folder might’ve never been opened as it is part of the default setup.

    ]]>

  3. Anonymous says:

    < ![CDATA[

    In theory this shouldn’t be an issue with the new architecture, containers will be prepared as if they were being displayed.



    Oh, I just think that the issue could be with the user menu, which is a special folder.

    ]]>

  4. Anonymous says:

    < ![CDATA[

    The user menu should not be child of any desktop and thus can not be reached by my script. I’ll share my code when I get back to my PC

    ]]>

  5. Anonymous says:

    < ![CDATA[

    ok, thanks

    ]]>

  6. Anonymous says:

    < ![CDATA[

    function Container(name, id, children) {


    this.name = name;


    this.id = id;


    this.children = children;


    }



    function check(item, array) {


    var t = item.getType();


    if (t == “Panel” || t == “Folder”) {


    var c = item.getContainer();


    var name = t + (t == “Folder” ? ” (” + item.getLabel() + “)” : “”) + ” #” + c.getId().toString(16);


    var children = [];


    var items = c.getAllItems();


    for (var i = 0; i < items.length; i++) {


    check(items[i], children);


    }


    array.push(new Container(name, c.getId(), children));


    }


    }



    var result = [];


    var desktops = LL.getAllDesktops();


    for (var i = 0; i < desktops.getLength(); i++) {


    var d = LL.getContainerById(desktops.getAt(i));


    var children = [];


    var items = d.getAllItems();


    for (var j = 0; j < items.length; j++) {


    check(items[j], children);


    }


    result.push(new Container(“Desktop (” + d.getName() + “) #” + d.getId().toString(16), d.getId(), children));


    }


    return JSON.stringify(result);

    ]]>

  7. Anonymous says:

    < ![CDATA[

    Thanks, I will have a look at this asap

    ]]>

  8. Anonymous says:

    < ![CDATA[

    Further testing results:


    – Not related to a specific folder, any folder shows the same behaviour, opened or not.


    – Does not happen with panels


    – Does not happen if there is no Folder Opener (even if there might be folders, like the user menu)

    ]]>

  9. Anonymous says:

    < ![CDATA[

    I am totally unable to reproduce the bug. It seems easy however 🙁


    Do you have scripts that could run in parallel when loading desktops (load event, custom views) ?

    ]]>

  10. Anonymous says:

    < ![CDATA[

    I am in the default setup, so nothing else should be running.


    Sidenote: I’ve sent a crashreport, but it is not related to this script. I hope I’ve not caused confusion.



    This script does not actually lead to a crash report, because it is eval’d via Repository Importer, which catches exceptions and prints them to the log. The evaling script is in the link below, relevant lines are 35++ https://github.com/TrianguloY/LLScript_Repository_Importer/blob/DokuJClient-branch/app/src/main/res/raw/executor.js

    ]]>

  11. Anonymous says:

    < ![CDATA[

    Hum, so it seems the context is a bit different then. At the moment I’m using tasker to run the script in background using the default setup and only this script I copy/pasted.


    That means that there is something more with the repository importer but I don’t see what at the moment.

    ]]>

  12. Anonymous says:

    < ![CDATA[

    Pierre Hébert


    Note: Cannot reproduce on 5.1 device, might be limited to 6.0 and/or emulators

    ]]>

  13. Anonymous says:

    < ![CDATA[

    Nope, can’t reproduce it neither on 4.4 nor 6.0. What should I do to run the script in the same context as you? I think I am not doing things correctly.


    I noticed something weird: I can’t decode the stacktrace, one of the minified class name is not in the mapping.txt file. Could you check if you have the r2715 version (sorry to ask this dumb question!)

    ]]>

  14. Anonymous says:

    < ![CDATA[

    My LL was actually on a10. Now I’m seeing a different exception at startup, but no exceptions in the script.




    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err: java.lang.Exception: TypeError: Cannot call method “getWidth” of null


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at java.lang.reflect.Constructor.newInstance(Native Method)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.bd.a(MemberBox.java:159)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.bx.a(NativeJavaClass.java:266)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.bx.a(NativeJavaClass.java:205)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.bx.construct(NativeJavaClass.java:166)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.ao.a(Interpreter.java:1519)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.ao.a(Interpreter.java:815)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.an.call(InterpretedFunction.java:109)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.ContextFactory.a(ContextFactory.java:394)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.dn.a(ScriptRuntime.java:3091)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.an.call(InterpretedFunction.java:107)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.JavaAdapter.b(JavaAdapter.java:603)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.JavaAdapter.a(JavaAdapter.java:15)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.at.a(JavaAdapter.java:583)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.l.a(Context.java:489)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.ContextFactory.call(ContextFactory.java:504)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at org.mozilla.javascript.JavaAdapter.callMethod(JavaAdapter.java:580)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at adapter1.handleMessage()


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at android.os.Handler.dispatchMessage(Handler.java:102)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at android.os.Looper.loop(Looper.java:148)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at android.app.ActivityThread.main(ActivityThread.java:5417)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at java.lang.reflect.Method.invoke(Native Method)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)


    10-24 17:45:03.959 11535-11535/net.pierrox.lightning_launcher_extreme W/System.err:     at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:114)

    ]]>

  15. Anonymous says:

    < ![CDATA[

    If my understanding is correct, the error happens in a scripted subclass. I don’t know how to track its location, you will probably have to guess where it fails by looking at usages of getWidth.


    If this is an error at startup, it could be that something is not ready yet, maybe a screen or desktop

    ]]>

  16. Anonymous says:

    < ![CDATA[

    Pierre Hébert


    I’ll ignore it for now as it doesn’t have any impact on my setup. I’ll revive this post if I find out more.

    ]]>

  17. Anonymous says:

    < ![CDATA[

    Ok, I’ll be ready to kill bugs 😉

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *