If the drugs were in plain view site. Then it was legal. Police when serving warrants will usually clear the house or apartment for there safety. So if the drugs were in plain view site as in sitting on a table or shelf or what ever. Then it was legal, and grounds for probable cause to obtain the search warrant.
Also being you had an arrest warrant for the sale of drugs that in itself alone is enough to establish probable cause for the warrant.

