[video_player] Fix pointer value to boolean conversion analyzer warnings (#3940)
Fix `Converting a pointer value of type 'NSNumber * _Nullable' to a primitive boolean value; instead, either compare the pointer to nil or call -boolValue` analyzer warnings.
Fixes https://github.com/flutter/flutter/issues/82958
diff --git a/packages/video_player/video_player/CHANGELOG.md b/packages/video_player/video_player/CHANGELOG.md
index 918a361..c40faab 100644
--- a/packages/video_player/video_player/CHANGELOG.md
+++ b/packages/video_player/video_player/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 2.1.3
+
+* Fix pointer value to boolean conversion analyzer warnings.
+
## 2.1.2
* Migrate maven repository from jcenter to mavenCentral.
diff --git a/packages/video_player/video_player/ios/Classes/messages.m b/packages/video_player/video_player/ios/Classes/messages.m
index 14e375b..0936bbc 100644
--- a/packages/video_player/video_player/ios/Classes/messages.m
+++ b/packages/video_player/video_player/ios/Classes/messages.m
@@ -65,9 +65,9 @@
return result;
}
- (NSDictionary *)toMap {
- return
- [NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]),
- @"textureId", nil];
+ return [NSDictionary
+ dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
+ @"textureId", nil];
}
@end
@@ -124,9 +124,10 @@
}
- (NSDictionary *)toMap {
return [NSDictionary
- dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
- (self.isLooping ? self.isLooping : [NSNull null]), @"isLooping",
- nil];
+ dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
+ @"textureId",
+ (self.isLooping != nil ? self.isLooping : [NSNull null]),
+ @"isLooping", nil];
}
@end
@@ -145,8 +146,9 @@
}
- (NSDictionary *)toMap {
return [NSDictionary
- dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
- (self.volume ? self.volume : [NSNull null]), @"volume", nil];
+ dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
+ @"textureId", (self.volume != nil ? self.volume : [NSNull null]),
+ @"volume", nil];
}
@end
@@ -165,8 +167,9 @@
}
- (NSDictionary *)toMap {
return [NSDictionary
- dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
- (self.speed ? self.speed : [NSNull null]), @"speed", nil];
+ dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
+ @"textureId", (self.speed != nil ? self.speed : [NSNull null]),
+ @"speed", nil];
}
@end
@@ -185,9 +188,10 @@
}
- (NSDictionary *)toMap {
return [NSDictionary
- dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
- (self.position ? self.position : [NSNull null]), @"position",
- nil];
+ dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
+ @"textureId",
+ (self.position != nil ? self.position : [NSNull null]),
+ @"position", nil];
}
@end
@@ -202,7 +206,7 @@
}
- (NSDictionary *)toMap {
return [NSDictionary
- dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]),
+ dictionaryWithObjectsAndKeys:(self.mixWithOthers != nil ? self.mixWithOthers : [NSNull null]),
@"mixWithOthers", nil];
}
@end
diff --git a/packages/video_player/video_player/pubspec.yaml b/packages/video_player/video_player/pubspec.yaml
index 6261a1d..c716e54 100644
--- a/packages/video_player/video_player/pubspec.yaml
+++ b/packages/video_player/video_player/pubspec.yaml
@@ -1,7 +1,7 @@
name: video_player
description: Flutter plugin for displaying inline video with other Flutter
widgets on Android, iOS, and web.
-version: 2.1.2
+version: 2.1.3
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
flutter: