Merge pull request #3142 from henricm/fix-for-win-mono_string_to_utf8
[mono.git] / mono / metadata / mono-route.c
index 4b5ca588056df60fcb60404b58fee9d8bd18fd79..d651b0e5b08387b9b4829e0ce74b612e1fc3cc54 100644 (file)
@@ -21,6 +21,7 @@
 
 extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfaceProperties_ParseRouteInfo_internal(MonoString *iface, MonoArray **gw_addr_list)
 {
+       MonoError error;
        size_t needed;
        in_addr_t in;
        int mib[6];
@@ -31,7 +32,10 @@ extern MonoBoolean ves_icall_System_Net_NetworkInformation_MacOsIPInterfacePrope
 
        MonoDomain *domain = mono_domain_get ();
 
-       ifacename = mono_string_to_utf8(iface);
+       ifacename = mono_string_to_utf8_checked(iface, &error);
+       if (mono_error_set_pending_exception (&error))
+               return FALSE;
+
        if ((ifindex = if_nametoindex(ifacename)) == 0)
                return FALSE;
        g_free(ifacename);