add a null check

This commit is contained in:
tibbi 2017-03-30 22:04:03 +02:00
parent baf6c36bcd
commit 7cf1b38578
1 changed files with 3 additions and 0 deletions

View File

@ -166,6 +166,9 @@ class Preview : ViewGroup, SurfaceHolder.Callback, MediaScannerConnection.OnScan
}
private fun getSelectedResolution(): Camera.Size {
if (mParameters == null)
mParameters = mCamera!!.parameters
var index = getResolutionIndex()
val resolutions = if (mIsVideoMode) {
mParameters!!.supportedVideoSizes ?: mParameters!!.supportedPreviewSizes