Merge pull request #98 from dart-lang/fix_npe
fix an npe in the getPlatformLocale method
diff --git a/.gitignore b/.gitignore
index 5d53a96..e3225ef 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.packages
+.idea/
.pub/
build/
pubspec.lock
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..884b2a8
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+ <component name="ProjectModuleManager">
+ <modules>
+ <module fileurl="file://$PROJECT_DIR$/.idea/usage.iml" filepath="$PROJECT_DIR$/.idea/usage.iml" />
+ </modules>
+ </component>
+</project>
\ No newline at end of file
diff --git a/.idea/usage.iml b/.idea/usage.iml
new file mode 100644
index 0000000..fdb5d5d
--- /dev/null
+++ b/.idea/usage.iml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output />
+ <content url="file://$MODULE_DIR$">
+ <excludeFolder url="file://$MODULE_DIR$/.pub" />
+ <excludeFolder url="file://$MODULE_DIR$/build" />
+ <excludeFolder url="file://$MODULE_DIR$/example/packages" />
+ <excludeFolder url="file://$MODULE_DIR$/packages" />
+ <excludeFolder url="file://$MODULE_DIR$/test/packages" />
+ <excludeFolder url="file://$MODULE_DIR$/test/src/packages" />
+ <excludeFolder url="file://$MODULE_DIR$/tool/packages" />
+ </content>
+ <orderEntry type="inheritedJdk" />
+ <orderEntry type="sourceFolder" forTests="false" />
+ <orderEntry type="library" name="Dart SDK" level="application" />
+ <orderEntry type="library" name="Dart Packages" level="project" />
+ </component>
+</module>
\ No newline at end of file
diff --git a/changelog.md b/changelog.md
index 16729df..04c4f61 100644
--- a/changelog.md
+++ b/changelog.md
@@ -1,5 +1,8 @@
# Changelog
+## 3.0.0+1
+- fixed an NPE in the `usage_io` `getPlatformLocale()` method
+
## 3.0.0
- removed the use of configurable imports
- removed the Flutter specific entry-point; Flutter apps can now use the
diff --git a/lib/src/usage_impl_io.dart b/lib/src/usage_impl_io.dart
index fe5cc44..ff1b153 100644
--- a/lib/src/usage_impl_io.dart
+++ b/lib/src/usage_impl_io.dart
@@ -142,7 +142,7 @@
if (locale != null) {
// Convert `en_US.UTF-8` to `en_US`.
int index = locale.indexOf('.');
- if (index != null) locale = locale.substring(0, index);
+ if (index != -1) locale = locale.substring(0, index);
// Convert `en_US` to `en-us`.
locale = locale.replaceAll('_', '-').toLowerCase();
diff --git a/pubspec.yaml b/pubspec.yaml
index 34dd640..80fad18 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
name: usage
-version: 3.0.0
+version: 3.0.0+1
description: A Google Analytics wrapper for both command-line, web, and Flutter apps.
homepage: https://github.com/dart-lang/usage
author: Dart Team <misc@dartlang.org>