summaryrefslogtreecommitdiff
path: root/fxjs/cjs_document.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cjs_document.cpp')
-rw-r--r--fxjs/cjs_document.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp
index 83711e1b28..2a36b61a4a 100644
--- a/fxjs/cjs_document.cpp
+++ b/fxjs/cjs_document.cpp
@@ -942,11 +942,9 @@ CJS_Return CJS_Document::get_document_file_name(CJS_Runtime* pRuntime) {
if (wsFilePath[i - 1] == L'\\' || wsFilePath[i - 1] == L'/')
break;
}
+ if (i > 0 && i < wsFilePath.GetLength())
+ return CJS_Return(pRuntime->NewString(wsFilePath.c_str() + i));
- if (i > 0 && i < wsFilePath.GetLength()) {
- return CJS_Return(
- pRuntime->NewString(wsFilePath.GetBuffer(wsFilePath.GetLength()) + i));
- }
return CJS_Return(pRuntime->NewString(L""));
}