Be grateful with null context
diff --git a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceDetector.java b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceDetector.java
index e2535b5..5d910b3 100644
--- a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceDetector.java
+++ b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceDetector.java
@@ -189,7 +189,10 @@
* @see #create(Context, float)
*/
public static FaceDetector create(Context context, float minConfidence, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads) {
- return new FaceDetector(context.getAssets(), minConfidence, hwAcceleration, enhancedHwAcceleration, numThreads);
+ AssetManager assetmanager = null;
+ if (context != null)
+ assetmanager = context.getAssets();
+ return new FaceDetector(assetmanager, minConfidence, hwAcceleration, enhancedHwAcceleration, numThreads);
}
/**
diff --git a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java
index 059140f..a374174 100644
--- a/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java
+++ b/FaceShared/src/main/java/com/libremobileos/yifan/face/FaceScanner.java
@@ -400,7 +400,10 @@
* @see #create(Context)
*/
public static FaceScanner create(Context context, boolean hwAcceleration, boolean enhancedHwAcceleration, int numThreads) {
- return new FaceScanner(context.getAssets(), hwAcceleration, enhancedHwAcceleration, numThreads);
+ AssetManager assetmanager = null;
+ if (context != null)
+ assetmanager = context.getAssets();
+ return new FaceScanner(assetmanager, hwAcceleration, enhancedHwAcceleration, numThreads);
}
/**