[UIKit] Add nullability to file (#15857)
File did not have nullability enabled. Add nullability and made some changes to code as safeguards.
This commit is contained in:
Родитель
815d91fbc9
Коммит
35cb9ac366
|
@ -11,11 +11,10 @@
|
|||
#if !WATCH
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Foundation;
|
||||
using ObjCRuntime;
|
||||
using CoreGraphics;
|
||||
#nullable enable
|
||||
|
||||
namespace UIKit {
|
||||
|
||||
|
@ -41,9 +40,9 @@ namespace UIKit {
|
|||
{
|
||||
var copyOfRecognizers = recognizers;
|
||||
var savedHandle = Handle;
|
||||
recognizers = null;
|
||||
recognizers = new Dictionary<Token, IntPtr> ();
|
||||
|
||||
if (copyOfRecognizers == null)
|
||||
if (copyOfRecognizers.Count == 0)
|
||||
return;
|
||||
|
||||
DangerousRetain (savedHandle);
|
||||
|
@ -168,7 +167,10 @@ namespace UIKit {
|
|||
//
|
||||
public IEnumerable<Token> GetTargets ()
|
||||
{
|
||||
return (IEnumerable<Token>) recognizers?.Keys ?? Array.Empty<Token> ();
|
||||
var keys = recognizers?.Keys;
|
||||
if (keys is null)
|
||||
return Array.Empty<Token> ();
|
||||
return (IEnumerable<Token>) keys;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче