A convicted drug dealer who attacked his girlfriend as she slept on a sofa has avoided prison a week after receiving a suspended sentence for assaulting police officers.