Improved logic for error detection.

Test: Ran windump, winlayer, surfacedump, surfacelayer, and a txt file
on winscope's autodetect file upload feature.
Change-Id: Ia638bb4fbd9c5ad24ac7c84814205eaa8d429824
Merged-In: Ia638bb4fbd9c5ad24ac7c84814205eaa8d429824
2 files changed