Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3a733323 authored by Jerome Gaillard's avatar Jerome Gaillard
Browse files

Fix LayoutlibTestCallback.getResourceId

Return null instead of triggering a NPE when there are no resource of
the asked type.

Test: RenderTests.testFonts
Change-Id: Ib45ebdf2178e62cbd987082512fcbb009de3f1b2
parent 4211358c
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -132,7 +132,11 @@ public class LayoutLibTestCallback extends LayoutlibCallback {

    @Override
    public Integer getResourceId(ResourceType type, String name) {
        return mResources.get(type).get(name);
        Map<String, Integer> resName2Id = mResources.get(type);
        if (resName2Id == null) {
            return null;
        }
        return resName2Id.get(name);
    }

    @Override