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

Commit 72c5e376 authored by Amith Yamasani's avatar Amith Yamasani Committed by Android Git Automerger
Browse files

am ba1ae3af: am 42786418: Don\'t instantiate non-Fragments in Fragment.instantiate

* commit 'ba1ae3af':
  Don't instantiate non-Fragments in Fragment.instantiate
parents 3bc3240f ba1ae3af
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -580,6 +580,10 @@ public class Fragment implements ComponentCallbacks2, OnCreateContextMenuListene
            if (clazz == null) {
                // Class not found in the cache, see if it's real, and try to add it
                clazz = context.getClassLoader().loadClass(fname);
                if (!Fragment.class.isAssignableFrom(clazz)) {
                    throw new InstantiationException("Trying to instantiate a class " + fname
                        + " that is not a Fragment", new ClassCastException());
                }
                sClassMap.put(fname, clazz);
            }
            Fragment f = (Fragment)clazz.newInstance();