Index: runtime/lib/string.cc |
diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc |
index ba42a57339a1643ec14246dc00d04558ce2193f1..ea67ae2b8035f0e5ce0e509efcfc83b88988b474 100644 |
--- a/runtime/lib/string.cc |
+++ b/runtime/lib/string.cc |
@@ -22,16 +22,16 @@ DEFINE_NATIVE_ENTRY(String_fromEnvironment, 3) { |
Dart_EnvironmentCallback callback = isolate->environment_callback(); |
if (callback != NULL) { |
Dart_Handle result = callback(Api::NewHandle(isolate, name.raw())); |
- if (Dart_IsError(result)) { |
+ if (Dart_IsString(result)) { |
+ const Object& value = |
+ Object::Handle(isolate, Api::UnwrapHandle(result)); |
+ return Symbols::New(String::Cast(value)); |
+ } else if (Dart_IsError(result)) { |
const Object& error = |
Object::Handle(isolate, Api::UnwrapHandle(result)); |
Exceptions::ThrowArgumentError( |
String::Handle( |
String::New(Error::Cast(error).ToErrorCString()))); |
- } else if (Dart_IsString(result)) { |
- const Object& value = |
- Object::Handle(isolate, Api::UnwrapHandle(result)); |
- return Symbols::New(String::Cast(value)); |
} else if (!Dart_IsNull(result)) { |
Exceptions::ThrowArgumentError( |
String::Handle(String::New("Illegal environment value"))); |