Skip to content

Commit d9c9d2b

Browse files
authored
WW-5546 Fixes NPE when uploaded file is empty (#1263)
1 parent d4f1adb commit d9c9d2b

File tree

2 files changed

+174
-172
lines changed

2 files changed

+174
-172
lines changed

core/src/main/java/org/apache/struts2/interceptor/AbstractFileUploadInterceptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected boolean acceptFile(Object action, UploadedFile file, String originalFi
115115
}
116116

117117
// If it's null the upload failed
118-
if (file == null) {
118+
if (file == null || file.getContent() == null) {
119119
String errMsg = getTextMessage(action, STRUTS_MESSAGES_ERROR_UPLOADING_KEY, new String[]{inputName});
120120
if (validation != null) {
121121
validation.addFieldError(inputName, errMsg);

0 commit comments

Comments
 (0)