Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.

adding nil check #1072

Merged
merged 8 commits into from
Jan 14, 2019
Merged

Conversation

cyanglaz
Copy link
Contributor

@cyanglaz cyanglaz commented Jan 13, 2019

Adding nil checks in NSDictionary and default them to NSNull to prevent crashes.

flutter/flutter#20761

## 0.3.3

* Fixed a crash on IOS when some of the package infos are not available.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra line here

@"packageName" : [[NSBundle mainBundle] bundleIdentifier],
@"version" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"],
@"buildNumber" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
@"appName" : [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: @"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this way the Dart side cannot tell if the property was set to an empty string or was absent.
Is it possible to use NSNull here if it's absent?

@@ -3,7 +3,7 @@ description: Flutter plugin for querying information about the application
package, such as CFBundleVersion on iOS or versionCode on Android.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/plugins/tree/master/packages/package_info
version: 0.3.2
version: 0.3.3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@amirh amirh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cyanglaz cyanglaz merged commit 23852d3 into flutter:master Jan 14, 2019
@cyanglaz cyanglaz deleted the packageinfo_ios_nil_crash branch January 14, 2019 18:24
andreidiaconu pushed a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
Adding nil checks in NSDictionary and default them to NSNull to prevent crashes.
andreidiaconu added a commit to andreidiaconu/plugins that referenced this pull request Feb 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants