             errorVariableDeclaration
             callCode
             potentialGuard + potentialThrow + returnVariableEquals + castCode + suffix
-            nilCode
+            nilGuardCode
         }
         return code
     }

        let potentialGuard: String
        let suffix: String
        let maybeRV: String
        let nilCode: String
        if throwsError {
            maybeRV = needsNilGuard ? ("maybe" + rvVar.uppercased()) : rvVar
            potentialGuard = ""

            potentialThrow = (doThrow ?
                                "if let error = error { throw GLibError(error) }\n" :
                                "g_log(messagePtr: error?.pointee.message, level: .error)\n")
            nilGuardCode = needsNilGuard ? "guard let " + rvVar + " = " + maybeRV + " else { return nil }\n" : CodeBuilder.unused
        } else {
            maybeRV = rvVar
            errorVariableDeclaration = CodeBuilder.unused
            potentialThrow = ""
            nilGuardCode = ""
            invocationTail = ")"
            potentialGuard = needsNilGuard ? "guard " : ""
            suffix = needsNilGuard ? " else { return nil }" : ""
