The code just checks the return value of getenv(), which is wrong.
Created attachment 80554 [details] Proposed patch
Fixed in r77065.