SetParameterByName issue

I created this script to swap door swing parameters when we mirror a house. Currently, we have 2 yes/no parameters for our doors (Swing Left & Swing Right). When we mirror a house, the value of these parameters have to swap; meaning if a door’s Swing Left parameter is set to yes, it needs to change to no and the value of the Swing Right parameter has to change from no to yes. I created this script and it does work, however, I get 2 errors. the first error says “no parameter found by that name” and the second error says “dereferencing a non-pointer.”

Do you have door families that are missing those parameters? Look at the values you get from GetParameterValueByName.

Yes, that was the issue. Garage doors & sheetrock openings do not have those parameters.

thanks