Skip to content

Commit

Permalink
ensure there is no null URI
Browse files Browse the repository at this point in the history
  • Loading branch information
n8fr8 committed Dec 17, 2024
1 parent 6298367 commit 458dfeb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -683,16 +683,27 @@ class CameraFragment : BaseFragment<FragmentCameraBinding>(R.layout.fragment_cam
allowMachineLearning
)

proofUri = Uri.fromFile(fileOut)
var proofUriC2pa = Uri.fromFile(fileOut)

if (proofUriC2pa != null)
proofUri = proofUriC2pa

}


val mw: MediaWatcher = MediaWatcher.getInstance(context)
val resultProofHash: String = mw.processUri(proofUri, isDirectCapture, dateSaved)

Timber.tag(CameraFragment.TAG).d("Photo proof generated: %s", resultProofHash)
if (proofUri != null) {
val resultProofHash: String? =
mw.processUri(proofUri, isDirectCapture, dateSaved)

Timber.tag(CameraFragment.TAG)
.d("Photo proof generated: %s", resultProofHash)
}
else
{
Timber.tag(CameraFragment.TAG)
.d("Photo URI was null")
}
}

override fun onError(exception: ImageCaptureException) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ public void setStorageProvider (StorageProvider storageProvider)
}

public static synchronized MediaWatcher getInstance(Context context) {
if (mInstance == null)

if (mInstance == null) {
mInstance = new MediaWatcher();
mInstance.init(context, null);
}

return mInstance;
}
Expand Down

0 comments on commit 458dfeb

Please sign in to comment.