[longomatch] Ignore invalid links



commit 1af4088861a4e04bad1ef2c76a6ec230282adf3e
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Tue Apr 14 03:00:21 2015 +0200

    Ignore invalid links

 .../CanvasObjects/Dashboard/CategoryObject.cs      |    6 +++++-
 LongoMatch.Drawing/Widgets/DashboardCanvas.cs      |   15 ++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/LongoMatch.Drawing/CanvasObjects/Dashboard/CategoryObject.cs 
b/LongoMatch.Drawing/CanvasObjects/Dashboard/CategoryObject.cs
index ae0fc04..38aba75 100644
--- a/LongoMatch.Drawing/CanvasObjects/Dashboard/CategoryObject.cs
+++ b/LongoMatch.Drawing/CanvasObjects/Dashboard/CategoryObject.cs
@@ -317,7 +317,11 @@ namespace LongoMatch.Drawing.CanvasObjects.Dashboard
                        if (sourceTags == null || sourceTags.Count == 0) {
                                return base.GetAnchor (sourceTags);
                        } else {
-                               return subcatAnchors [sourceTags [0]];
+                               if (subcatAnchors.ContainsKey (sourceTags [0])) {
+                                       return subcatAnchors [sourceTags [0]];
+                               } else {
+                                       return null;
+                               }
                        }
                }
 
diff --git a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
index 6db9e40..caf595e 100644
--- a/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
+++ b/LongoMatch.Drawing/Widgets/DashboardCanvas.cs
@@ -412,11 +412,16 @@ namespace LongoMatch.Drawing.Widgets
 
                        foreach (DashboardButtonObject buttonObject in buttonsDict.Values) {
                                foreach (ActionLink link in buttonObject.Button.ActionLinks) {
-                                       LinkAnchorObject sourceAnchor = buttonObject.GetAnchor 
(link.SourceTags);
-                                       LinkAnchorObject destAnchor = buttonsDict [link.DestinationButton].
-                                               GetAnchor (link.DestinationTags);
-                                       ActionLinkObject linkObject = new ActionLinkObject (sourceAnchor,
-                                                                             destAnchor, link);
+                                       LinkAnchorObject sourceAnchor, destAnchor;
+                                       ActionLinkObject linkObject;
+
+                                       sourceAnchor = buttonObject.GetAnchor (link.SourceTags);
+                                       destAnchor = buttonsDict [link.DestinationButton].GetAnchor 
(link.DestinationTags);
+                                       if (destAnchor == null) {
+                                               Log.Error ("Skipping link with invalid destination tags");
+                                               continue;
+                                       }
+                                       linkObject = new ActionLinkObject (sourceAnchor, destAnchor, link);
                                        link.SourceButton = buttonObject.Button;
                                        linkObject.Visible = ShowLinks;
                                        AddObject (linkObject);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]