mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Fixing null reference when no Urls are set in Warmup
--HG-- branch : 1.x
This commit is contained in:
@@ -45,11 +45,13 @@ namespace Orchard.Warmup.Controllers {
|
||||
var warmupPart = Services.WorkContext.CurrentSite.As<WarmupSettingsPart>();
|
||||
|
||||
if(TryUpdateModel(warmupPart)) {
|
||||
using (var urlReader = new StringReader(warmupPart.Urls)) {
|
||||
string relativeUrl;
|
||||
while (null != (relativeUrl = urlReader.ReadLine())) {
|
||||
if(!Uri.IsWellFormedUriString(relativeUrl, UriKind.Relative) || !(relativeUrl.StartsWith("/"))) {
|
||||
AddModelError("Urls", T("{0} is an invalid warmup url.", relativeUrl));
|
||||
if (!String.IsNullOrEmpty(warmupPart.Urls)) {
|
||||
using (var urlReader = new StringReader(warmupPart.Urls)) {
|
||||
string relativeUrl;
|
||||
while (null != (relativeUrl = urlReader.ReadLine())) {
|
||||
if (!Uri.IsWellFormedUriString(relativeUrl, UriKind.Relative) || !(relativeUrl.StartsWith("/"))) {
|
||||
AddModelError("Urls", T("{0} is an invalid warmup url.", relativeUrl));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace Orchard.FileSystems.VirtualPath {
|
||||
&& !HostingEnvironment.VirtualPathProvider.FileExists(virtualPath)) {
|
||||
// if trying to monitor a directory or file inside a directory which doesn't exist
|
||||
// monitor first existing parent directory
|
||||
new Token(virtualPath);
|
||||
return new Token(virtualPath);
|
||||
}
|
||||
|
||||
BindSignal(virtualPath);
|
||||
|
||||
Reference in New Issue
Block a user