Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Fixed a NullPointerException case on Digest authentication.

lucciomanaa55d71cf53c
diff --git a/source/net/yacy/http/YaCyLegacyCredential.java b/source/net/yacy/http/YaCyLegacyCredential.java
index 5deb9accd..13c217002 100644
--- a/source/net/yacy/http/YaCyLegacyCredential.java
+++ b/source/net/yacy/http/YaCyLegacyCredential.java
@@ -65,8 +65,11 @@ public class YaCyLegacyCredential extends Credential {
public boolean check(Object credentials) {
if (credentials instanceof Credential) { // for DIGEST auth
- return ((Credential) credentials).check(c);
-
+ if(this.c == null) {
+ /* credential may be null after switching from BASIC to DIGEST authentication without re-encoding the password */
+ return false;
+ }
+ return ((Credential) credentials).check(this.c);
}
if (credentials instanceof String) { // for BASIC auth
final String pw = (String) credentials;