Skip to content

Commit

Permalink
Feature/null ref fix on adding link (#265)
Browse files Browse the repository at this point in the history
* fixing bug to handle null ref exception when adding link during import
* Dont add epic child link if Child link configuration missing. Show meaningful error.
  • Loading branch information
madkoo committed Jul 31, 2020
1 parent 0b3ed27 commit eabcaeb
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/WorkItemMigrator/JiraExport/JiraMapper.cs
Expand Up @@ -84,12 +84,17 @@ private void AddSingleLink(JiraRevision r, List<WiLink> links, string field, str
var changeType = value == null ? ReferenceChangeType.Removed : ReferenceChangeType.Added;
var linkType = (from t in _config.LinkMap.Links where t.Source == type select t.Target).FirstOrDefault();

// regardless if action is add or remove, as there can be only one, we remove previous epic link if it exists

if (changeType == ReferenceChangeType.Added)
{
string linkedItemKey = (string)value;

if (string.IsNullOrEmpty(linkType))
{
Logger.Log(LogLevel.Warning, $"Cannot add 'Child' {linkedItemKey} link to 'Parent' {r.ParentItem.Key}, 'Child' link-map configuration missing.");
return;
}

var link = new WiLink()
{
Change = changeType,
Expand Down

0 comments on commit eabcaeb

Please sign in to comment.