Skip to content

Commit

Permalink
Fix for crash on links with undefined href
Browse files Browse the repository at this point in the history
  • Loading branch information
vithar committed Sep 30, 2017
1 parent af56ecd commit 7fcf033
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gorshochek",
"version": "2.7.1",
"version": "2.7.2",
"description": "Set of plugins for BEM site data generation",
"keywords": [
"BEM",
Expand Down
4 changes: 2 additions & 2 deletions src/tasks/override/override-doc-links.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,8 +170,8 @@ module.exports = (model, params) => {
function override(page, sourceUrlsMap, existedUrls, source) {
const $ = cheerio.load(source, {decodeEntities: false});
$('a').each(function() {
$(this).attr('href',
findLinkHrefReplacement($(this).attr('href'), page, sourceUrlsMap, existedUrls));
const href = $(this).attr('href');
href && $(this).attr('href', findLinkHrefReplacement(href, page, sourceUrlsMap, existedUrls));
});
/*
$('img').each(function() {
Expand Down

0 comments on commit 7fcf033

Please sign in to comment.