summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2012-04-05 09:29:52 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2012-04-05 09:29:52 -0700
commit90ec615c3a45e2b620d4270826aee85eba4f368a (patch)
tree34034091800980bf9be81a0ff9518147bfaa32ac
parent57a6ac092dc7f723381b5145b34ecff2eea3e724 (diff)
downloadDotNetOpenAuth-90ec615c3a45e2b620d4270826aee85eba4f368a.zip
DotNetOpenAuth-90ec615c3a45e2b620d4270826aee85eba4f368a.tar.gz
DotNetOpenAuth-90ec615c3a45e2b620d4270826aee85eba4f368a.tar.bz2
Fixes NullReferenceException in UriIdentifier.Initialize on mono.
Thanks to merarischroeder (https://github.com/merarischroeder) for reporting this issue and prescribing the fix. Fixes #111
-rw-r--r--src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs b/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs
index 2048b0f..d601aed 100644
--- a/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs
+++ b/src/DotNetOpenAuth.OpenId/OpenId/UriIdentifier.cs
@@ -712,7 +712,10 @@ namespace DotNetOpenAuth.OpenId {
[SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Schemes are traditionally displayed in lowercase.")]
internal void Initialize(bool hideNonStandardScheme) {
if (schemeField == null) {
- schemeField = typeof(UriParser).GetField("m_Scheme", BindingFlags.NonPublic | BindingFlags.Instance);
+ schemeField =
+ typeof(UriParser).GetField("m_Scheme", BindingFlags.NonPublic | BindingFlags.Instance) ?? // .NET
+ typeof(UriParser).GetField("scheme_name", BindingFlags.NonPublic | BindingFlags.Instance); // Mono
+ ErrorUtilities.VerifyInternal(schemeField != null, "Unable to find the private field UriParser.m_Scheme");
}
this.RegisteredScheme = (string)schemeField.GetValue(this);