Skip to content

Commit 0f17c87

Browse files
jmagmanfotiDim
authored andcommitted
[video_player] Fix pointer value to boolean conversion analyzer warnings (flutter#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 flutter/flutter#82958
1 parent 3139ab5 commit 0f17c87

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

packages/video_player/video_player/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.3
2+
3+
* Fix pointer value to boolean conversion analyzer warnings.
4+
15
## 2.1.2
26

37
* Migrate maven repository from jcenter to mavenCentral.

packages/video_player/video_player/ios/Classes/messages.m

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ + (FLTTextureMessage *)fromMap:(NSDictionary *)dict {
6565
return result;
6666
}
6767
- (NSDictionary *)toMap {
68-
return
69-
[NSDictionary dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]),
70-
@"textureId", nil];
68+
return [NSDictionary
69+
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
70+
@"textureId", nil];
7171
}
7272
@end
7373

@@ -124,9 +124,10 @@ + (FLTLoopingMessage *)fromMap:(NSDictionary *)dict {
124124
}
125125
- (NSDictionary *)toMap {
126126
return [NSDictionary
127-
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
128-
(self.isLooping ? self.isLooping : [NSNull null]), @"isLooping",
129-
nil];
127+
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
128+
@"textureId",
129+
(self.isLooping != nil ? self.isLooping : [NSNull null]),
130+
@"isLooping", nil];
130131
}
131132
@end
132133

@@ -145,8 +146,9 @@ + (FLTVolumeMessage *)fromMap:(NSDictionary *)dict {
145146
}
146147
- (NSDictionary *)toMap {
147148
return [NSDictionary
148-
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
149-
(self.volume ? self.volume : [NSNull null]), @"volume", nil];
149+
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
150+
@"textureId", (self.volume != nil ? self.volume : [NSNull null]),
151+
@"volume", nil];
150152
}
151153
@end
152154

@@ -165,8 +167,9 @@ + (FLTPlaybackSpeedMessage *)fromMap:(NSDictionary *)dict {
165167
}
166168
- (NSDictionary *)toMap {
167169
return [NSDictionary
168-
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
169-
(self.speed ? self.speed : [NSNull null]), @"speed", nil];
170+
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
171+
@"textureId", (self.speed != nil ? self.speed : [NSNull null]),
172+
@"speed", nil];
170173
}
171174
@end
172175

@@ -185,9 +188,10 @@ + (FLTPositionMessage *)fromMap:(NSDictionary *)dict {
185188
}
186189
- (NSDictionary *)toMap {
187190
return [NSDictionary
188-
dictionaryWithObjectsAndKeys:(self.textureId ? self.textureId : [NSNull null]), @"textureId",
189-
(self.position ? self.position : [NSNull null]), @"position",
190-
nil];
191+
dictionaryWithObjectsAndKeys:(self.textureId != nil ? self.textureId : [NSNull null]),
192+
@"textureId",
193+
(self.position != nil ? self.position : [NSNull null]),
194+
@"position", nil];
191195
}
192196
@end
193197

@@ -202,7 +206,7 @@ + (FLTMixWithOthersMessage *)fromMap:(NSDictionary *)dict {
202206
}
203207
- (NSDictionary *)toMap {
204208
return [NSDictionary
205-
dictionaryWithObjectsAndKeys:(self.mixWithOthers ? self.mixWithOthers : [NSNull null]),
209+
dictionaryWithObjectsAndKeys:(self.mixWithOthers != nil ? self.mixWithOthers : [NSNull null]),
206210
@"mixWithOthers", nil];
207211
}
208212
@end

packages/video_player/video_player/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: video_player
22
description: Flutter plugin for displaying inline video with other Flutter
33
widgets on Android, iOS, and web.
4-
version: 2.1.2
4+
version: 2.1.3
55
homepage: https://github.com/flutter/plugins/tree/master/packages/video_player/video_player
66

77
flutter:

0 commit comments

Comments
 (0)