mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-02-04 05:35:44 +00:00
ColorPicker throws NullReferenceException if it cannot parse its value as a valid color.
This commit is contained in:
16
Radzen.Blazor.Tests/ColorPickerTests.cs
Normal file
16
Radzen.Blazor.Tests/ColorPickerTests.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using Bunit;
|
||||
using Xunit;
|
||||
|
||||
namespace Radzen.Blazor.Tests
|
||||
{
|
||||
public class ColorPickerTests
|
||||
{
|
||||
[Fact]
|
||||
public void ColorPicker_ShouldAcceptInvalidValues()
|
||||
{
|
||||
using var ctx = new TestContext();
|
||||
|
||||
var component = ctx.RenderComponent<RadzenColorPicker>(ComponentParameter.CreateParameter("Value", "invalid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -366,7 +366,8 @@ namespace Radzen.Blazor
|
||||
void Init()
|
||||
{
|
||||
var value = Value;
|
||||
if (String.IsNullOrEmpty(Value))
|
||||
|
||||
if (String.IsNullOrEmpty(Value) || RGB.Parse(Value) == null)
|
||||
{
|
||||
value = "rgb(255, 255, 255)";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user