fix throw exception

This commit is contained in:
MyDrift 2024-08-22 21:18:51 +02:00
parent 7e3d124a24
commit f284173767

View File

@ -36,10 +36,8 @@ function Invoke-WPFUIElements {
throw "Failed to retrieve Styles using 'FindResource' from main window element."
}
try {
$targetGrid = $window.FindName($targetGridName)
} catch {
throw "Failed to find the target grid '$targetGridName' in the main window."
if (!$targetGrid) {
throw "Failed to retrieve Target Grid by name, provided name: $targetGrid"
}
# Clear existing ColumnDefinitions and Children