In current version of Cookie Clicker (2.029), Game.Objects[].buy() will actually sell buildings if the store is in sell mode. Since buildings get more efficient when you sell them, this will usually cause FC to sell all of that building type as it keeps trying to autobuy them. The safeBuy() function makes sure the store is in buy mode before trying to buy a building.
In current version of Cookie Clicker (2.029), Game.Objects[].buy() will actually sell buildings if the store is in sell mode. Since buildings get more efficient when you sell them, this will usually cause FC to sell all of that building type as it keeps trying to autobuy them. The safeBuy() function makes sure the store is in buy mode before trying to buy a building.