Well, presumably you sold your call *expecting* either early assignment, or the drop in stock price that would follow the dividend. You wouldn't have been "screwed".
For the covered call, getting assigned isn't so bad if your strike is above the price of the UL. It's not a realized loss, but it is a lost opportunity to have sold the UL for a higher profit if the UL stock price goes above strike + call premium.
However, as the call writer, you are not in control of what happens. Sometimes you want to get assigned to get rid of the shares, and sometimes you would prefer to hold the shares and collect the call premium for extra income.
Either way, it would help a lot to have some tool to be able to figure out those odds of early assignment, to see which one is more likely to occur.
For a cash-covered put, it is a more problematic issue - getting assigned (early or not) means you now own shares at a price below the strike price. You may have an unrealized loss if the UL moves below strike + put premium.