Browse Source

Fixed null reference exception that occurred if the WiX dialog designer was switched to when no WiX project was open.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1660 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Matt Ward 19 years ago
parent
commit
95a1d1da42
  1. 2
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/NameValueListEditor.cs
  2. 9
      src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs
  3. 5
      src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocument.cs
  4. 24
      src/AddIns/BackendBindings/WixBinding/Test/Document/GetValueWithNoProjectTestFixture.cs
  5. 1
      src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

2
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/NameValueListEditor.cs

@ -120,7 +120,7 @@ namespace ICSharpCode.WixBinding @@ -120,7 +120,7 @@ namespace ICSharpCode.WixBinding
//
// valueColumn
//
this.valueColumn.HeaderText = "ValueColumn";
this.valueColumn.HeaderText = "Value";
this.valueColumn.Name = "valueColumn";
this.valueColumn.Width = 400;
//

9
src/AddIns/BackendBindings/WixBinding/Project/Src/Gui/WixDialogDesigner.cs

@ -289,9 +289,12 @@ namespace ICSharpCode.WixBinding @@ -289,9 +289,12 @@ namespace ICSharpCode.WixBinding
/// </summary>
WixProject GetProject()
{
foreach (IProject project in ProjectService.OpenSolution.Projects) {
if (project.IsFileInProject(base.viewContent.FileName)) {
return project as WixProject;
Solution openSolution = ProjectService.OpenSolution;
if (openSolution != null) {
foreach (IProject project in openSolution.Projects) {
if (project.IsFileInProject(base.viewContent.FileName)) {
return project as WixProject;
}
}
}
return null;

5
src/AddIns/BackendBindings/WixBinding/Project/Src/WixDocument.cs

@ -419,7 +419,10 @@ namespace ICSharpCode.WixBinding @@ -419,7 +419,10 @@ namespace ICSharpCode.WixBinding
/// </summary>
public string GetValue(string name)
{
return project.GetVariable(name);
if (project != null) {
return project.GetVariable(name);
}
return null;
}
/// <summary>

24
src/AddIns/BackendBindings/WixBinding/Test/Document/GetValueWithNoProjectTestFixture.cs

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Matthew Ward" email="mrward@users.sourceforge.net"/>
// <version>$Revision$</version>
// </file>
using ICSharpCode.WixBinding;
using NUnit.Framework;
using System;
namespace WixBinding.Tests.Document
{
[TestFixture]
public class GetValueWithNoProjectTestFixture
{
[Test]
public void NullReturned()
{
WixDocument doc = new WixDocument();
Assert.IsNull(doc.GetValue("test"));
}
}
}

1
src/AddIns/BackendBindings/WixBinding/Test/WixBinding.Tests.csproj

@ -142,6 +142,7 @@ @@ -142,6 +142,7 @@
<Compile Include="DialogXmlGeneration\ListViewItemAddedTestFixture.cs" />
<Compile Include="DialogXmlGeneration\ListViewItemRemovedTestFixture.cs" />
<Compile Include="DialogXmlGeneration\ListViewAddedTestFixture.cs" />
<Compile Include="Document\GetValueWithNoProjectTestFixture.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Project\WixBinding.csproj">

Loading…
Cancel
Save