No more NullReferenceExceptions



  •  So I was looking over a code file today and stumbled across this wonderful piece of code.

     

    Try

        If ViewState("sExpandSection").ToString() = "" Then

        Else

    End If

    Catch ex As Exception

    ViewState("sExpandSection") = ""

    End Try



  • It took me a while to understand what's happening. Disgusting.

     

    The real WTF is the usage of the ViewState.



  • I know a couple of companies that have a policy of firing people who code like that.



  • [quote user="Renan "C#" Sousa"]I know a couple of companies that have a policy of firing people who code like that.[/quote]

    I could reach into the VB code I have here with my eyes closed and grab a handful of examples worse than this.



  • [quote user="Renan "C#" Sousa"]I know a couple of companies that have a policy of firing people who code like that.[/quote]

    I strongly object to this policy, because it is not slow and painful enough. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.