Protect against unset current_path
This commit is contained in:
parent
5a585dd3ab
commit
d553c6a88e
2 changed files with 2 additions and 1 deletions
|
@ -70,6 +70,7 @@ module Middleman
|
||||||
# Get the resource object for the current path
|
# Get the resource object for the current path
|
||||||
# @return [Middleman::Sitemap::Resource]
|
# @return [Middleman::Sitemap::Resource]
|
||||||
def current_resource
|
def current_resource
|
||||||
|
return nil unless current_path
|
||||||
sitemap.find_resource_by_destination_path(current_path)
|
sitemap.find_resource_by_destination_path(current_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ module Middleman
|
||||||
def asset_url(path, prefix="")
|
def asset_url(path, prefix="")
|
||||||
path = super(path, prefix)
|
path = super(path, prefix)
|
||||||
|
|
||||||
if path.include?("//")
|
if path.include?("//") || !current_resource
|
||||||
path
|
path
|
||||||
else
|
else
|
||||||
current_dir = Pathname('/' + current_resource.destination_path)
|
current_dir = Pathname('/' + current_resource.destination_path)
|
||||||
|
|
Loading…
Reference in a new issue