Fix up a few issues thumper pointed out in the fixes for LP: #1005569.
* Use else instead of unconditional reset (makes the first call faster, but all others slower, negligibly) * Don't mask locals by reusing the same name * Remember to reset arg[7] for XkbStateNotify * Check for NULL strings. Don't dereference them, just treat as empty.