My son has a history of azthma now has croup?

My son is 5 years old. He has a history of azthma. Today he was rushed to the hospital because he was having trouble breathing. They said he has croup. My question is if it is ok to give cough medication to him. The night before our hospital trip I visited a local Medical Center and was told he had a cold and to give him cough meds. Could this have made him worse.