diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c
index ebf366eea3e8950ecf383f0ce2317910626b7da0..0bcf8158ce1c2e47672b1436ac9fa61f85e3354a 100644
--- a/src/xpdev/dirwrap.c
+++ b/src/xpdev/dirwrap.c
@@ -822,12 +822,10 @@ char* DLLCALL backslash(char* path)
 
 	p=lastchar(path);
 
-	if(!IS_PATH_DELIM(*p)) {
+	if(*p && !IS_PATH_DELIM(*p)) {
 #if defined(__unix__)
 		/* Convert trailing backslash to forwardslash on *nix */
-		if(*p!='\\' && *p)
-#else
-		if(*p)
+		if(*p!='\\')
 #endif
 			p++;
 		*p=PATH_DELIM;