Unplanned
Last Updated: 23 Apr 2026 12:00 by Gary
Gary
Created on: 23 Apr 2026 12:00
Category: FileManager
Type: Feature Request
1
Add null-guard for "target" in ReflectionExtensions to prevent NullReferenceException

Three methods in Telerik.Blazor.Extensions.ReflectionExtensions call target.GetType() without first checking whether target is null. When a null object reaches any of these methods (e.g. via ConvertToFileEntry receiving a null data item), a NullReferenceException is thrown. Consider adding a null return/guard, which will prevent the exception.

Affected methods:

HasGetter                 
GetPropertyValue   
SetPropertyValue   

Proposed change:

Add an early null return/guard for target in each method, consistent with the existing null check for propertyName:

public static bool HasGetter(this object target, string propertyName)
{
    if (target == null || propertyName == null)
    {
        return false;
    }
    // ...
}

public static object GetPropertyValue(this object target, string propertyName)
{
    if (target == null || propertyName == null)
    {
        return null;
    }
    // ...
}

public static void SetPropertyValue(this object target, string propertyName, object value)
{
    if (target == null)
    {
        return;
    }
    // ...
}

Expected outcome

  • No NRE is thrown when a null object reaches these methods.
  • Callers receive a graceful null/false/no-op result and can handle it at the appropriate level.
  • The real problem (a null item being passed to ConvertToFileEntry) surfaces as a missing/empty details pane rather than an unhandled exception that breaks the entire component subtree.

 

 

0 comments