fix NullReference exception in NReadability.MetaExtractor
This commit is contained in:
2014-01-04 12:07:24 +01:00
parent c57c5e8c18
commit aa06984276
4 changed files with 23 additions and 6 deletions
+4
View File
@@ -1,3 +1,7 @@
### 4.2.1
- fixes [issue #3](https://github.com/ceee/ReadSharp/issues/3)
### 4.2.0
- use custom encoders if not supported on platform (implemented for ISO-8859 and Windows range).
+7 -4
View File
@@ -123,11 +123,14 @@ namespace ReadSharp.Ports.NReadability
{ "http-equiv|Content-Type", "content" }
});
int charsetStart = result.IndexOf("charset=");
if (charsetStart > 0)
if (!String.IsNullOrEmpty(result))
{
charsetStart += 8;
result = result.Substring(charsetStart, result.Length - charsetStart);
int charsetStart = result.IndexOf("charset=");
if (charsetStart > 0)
{
charsetStart += 8;
result = result.Substring(charsetStart, result.Length - charsetStart);
}
}
}
+10
View File
@@ -119,5 +119,15 @@ namespace ReadSharp.Tests
Article result = await reader.Read(new Uri("http://www.uelike.com"));
Assert.Equal(result.Title, expectedTitle);
}
[Fact]
public async Task TestCriticalURIs()
{
Article result = await reader.Read(new Uri("http://www.jetbrains.com/resharper/whatsnew/index.html"));
Assert.NotEmpty(result.Content);
result = await reader.Read(new Uri("http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx"));
Assert.NotEmpty(result.Content);
}
}
}
+2 -2
View File
@@ -22,5 +22,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("4.2.0")]
[assembly: AssemblyFileVersion("4.2.0")]
[assembly: AssemblyVersion("4.2.1")]
[assembly: AssemblyFileVersion("4.2.1")]