From 21071b4923bab8b2a310ffb4e921c4c0fb6c345c Mon Sep 17 00:00:00 2001 From: Hee Jung Date: Fri, 20 Mar 2020 14:23:15 -0700 Subject: [PATCH] Expose isInitialized function for SoLoader Summary: Expose isInitialized function for SoLoader Reviewed By: kevinfrei Differential Revision: D20559686 fbshipit-source-id: b71b8b939648de3c50cbc26d378b5183c143da31 --- java/com/facebook/soloader/SoLoader.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/java/com/facebook/soloader/SoLoader.java b/java/com/facebook/soloader/SoLoader.java index 738b00c..cfc14fb 100644 --- a/java/com/facebook/soloader/SoLoader.java +++ b/java/com/facebook/soloader/SoLoader.java @@ -926,11 +926,15 @@ public static String makeNonZipPath(final String localLdLibraryPath) { } private static void assertInitialized() { + if (!isInitialized()) { + throw new RuntimeException("SoLoader.init() not yet called"); + } + } + + public static boolean isInitialized() { sSoSourcesLock.readLock().lock(); try { - if (sSoSources == null) { - throw new RuntimeException("SoLoader.init() not yet called"); - } + return sSoSources != null; } finally { sSoSourcesLock.readLock().unlock(); }