Skip to content

Commit

Permalink
Merge pull request #90 from EssentialNRG/hotfix/null-ref-barcodeview-ios
Browse files Browse the repository at this point in the history
Update BarcodeView for iOS to prevent NullRefrenceException
  • Loading branch information
afriscic authored Oct 1, 2024
2 parents e26d533 + de1d1ee commit 79d5de5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions BarcodeScanning.Native.Maui/Platform/MaciOS/BarcodeView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ public override void LayoutSubviews()
{
_previewLayer.Frame = layer.Bounds;

if (_previewLayer.Connection is not null && _previewLayer.Connection.SupportsVideoOrientation)
_previewLayer.Connection.VideoOrientation = this.Window?.WindowScene?.InterfaceOrientation switch
var connection = _previewLayer.Connection;
if (connection is not null && connection.SupportsVideoOrientation)
connection.VideoOrientation = this.Window?.WindowScene?.InterfaceOrientation switch
{
UIInterfaceOrientation.LandscapeLeft => AVCaptureVideoOrientation.LandscapeLeft,
UIInterfaceOrientation.LandscapeRight => AVCaptureVideoOrientation.LandscapeRight,
Expand Down

0 comments on commit 79d5de5

Please sign in to comment.