Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled exception, due to packageRoot returning null instead of empty string #2

Closed
srawlins opened this issue Jan 30, 2016 · 1 comment

Comments

@srawlins
Copy link
Owner

Copied from localvoid/issues/6:

@sebe:

Hi, the dart sdk v1.14.0 returns a Null now instead of empty string, for packageRoot.
I just updated my local copy of standalone.dart to test for null first and it work fine now.
if (packageRoot != null && packageRoot.isNotEmpty && p.startsWith(_packagesPrefix)) {

Next time someone does an update, maybe they could look at this.

api details
++++++++++++
change from
https://api.dartlang.org/1.13.2/dart-io/Platform/packageRoot.html
If there is no --package-root flag, then the empty string is returned.
to
https://api.dartlang.org/1.14.0/dart-io/Platform/packageRoot.html
If there is no --package-root flag, then null is returned.

Error details
+++++++++++++++++
Unhandled exception:
The null object does not have a getter 'isNotEmpty'.

NoSuchMethodError: method not found: 'isNotEmpty'
Receiver: null
Arguments: []

0 Object._noSuchMethod (dart:core-patch/object_patch.dart:42)

1 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)

2 _loadAsBytes (package:timezone/standalone.dart:48:21)

3 initializeTimeZone (package:timezone/standalone.dart:95:10)

4 main (file:///home/pi/time_dart14/main.dart:5:4)

5 _startIsolate. (dart:isolate-patch/isolate_patch.dart:261)

6 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:148)

@sebe
Copy link

sebe commented Feb 1, 2016

Hey @srawlins thanks for looking at this, but
problem is not fixed, standalone.dart still has packageRoot.isNotEmpty at line 48 and 70.
It's the test to see if packageRoot is empty or not, issue is it has change form empty string to a null.
So needs a packageRoot != null test or something.

Edit: this should work and current and older api
if ((packageRoot??'').isNotEmpty && p.startsWith(_packagesPrefix)) {

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants