So the other fish only died recently? I imagine it should be ok, my fish have always seemed to be ok with a new partner. Just don't leave it for too long, I had one goldfish on its own for about 2 years and then I brought a new much smaller one and the older goldfish got completely freaked out by it even though before he had lived with other fish (just a long time ago to it).

If you're going to get a new fish, make sure that you have a second tank for quarantine! It should be cycled with a mature filter. And you should keep your new fish there at least for 2 weeks in a salt solution. This will kill possible parasites.

As long as your tank has plenty of space for two goldfish (about 20 gallons as minimum) there shouldn't be much of a problem with your fish! If you're still worried, you could try introducing them at the same time. As in, take out your current fish when you're going to add the new one, and try to put them both back at the same time! Then both of them will be "strangers" at the same time