The Seventh Circuit (in U.S. v. Jackson) upholds this against a Second Amendment challenge, in an opinion by Judge Frank Easterbrook.
The Court said in Heller that the Constitution entitles citizens to keep and bear arms for the purpose of lawful self-protection, not for all self-protection. Jackson was distributing illegal drugs (cocaine and unlicensed dextromethorphan hydrobromide tablets) out of his home. The Constitution does not give anyone the right to be armed while committing a felony, or even to have guns in the next room for emergency use should suppliers, customers, or the police threaten a dealer