#vulnerable code 
                                private void handleUpdate(CoapExchange exchange, Request request, String registrationId) {
        // Get identity
        Identity sender = extractIdentity(exchange);

        // Create LwM2m request from CoAP request
        Long lifetime = null;
        String smsNumber = null;
        BindingMode binding = null;
        Link[] objectLinks = null;
        for (String param : request.getOptions().getUriQuery()) {
            if (param.startsWith(QUERY_PARAM_LIFETIME)) {
                lifetime = Long.valueOf(param.substring(3));
            } else if (param.startsWith(QUERY_PARAM_SMS)) {
                smsNumber = param.substring(4);
            } else if (param.startsWith(QUERY_PARAM_BINDING_MODE)) {
                binding = BindingMode.valueOf(param.substring(2));
            }
        }
        if (request.getPayload() != null && request.getPayload().length > 0) {
            objectLinks = Link.parse(request.getPayload());
        }
        UpdateRequest updateRequest = new UpdateRequest(registrationId, lifetime, smsNumber, binding, objectLinks);

        // Handle request
        UpdateResponse updateResponse = registrationHandler.update(sender, updateRequest);

        // Create CoAP Response from LwM2m request
        exchange.respond(fromLwM2mCode(updateResponse.getCode()), updateResponse.getErrorMessage());
    } 
                            #location 25 
                            #vulnerability type NULL_DEREFERENCE
#fixed code
                                private void handleUpdate(CoapExchange exchange, Request request, String registrationId) {
        // Get identity
        Identity sender = extractIdentity(exchange);

        // Create LwM2m request from CoAP request
        Long lifetime = null;
        String smsNumber = null;
        BindingMode binding = null;
        Link[] objectLinks = null;
        for (String param : request.getOptions().getUriQuery()) {
            if (param.startsWith(QUERY_PARAM_LIFETIME)) {
                lifetime = Long.valueOf(param.substring(3));
            } else if (param.startsWith(QUERY_PARAM_SMS)) {
                smsNumber = param.substring(4);
            } else if (param.startsWith(QUERY_PARAM_BINDING_MODE)) {
                binding = BindingMode.valueOf(param.substring(2));
            }
        }
        if (request.getPayload() != null && request.getPayload().length > 0) {
            objectLinks = Link.parse(request.getPayload());
        }
        UpdateRequest updateRequest = new UpdateRequest(registrationId, lifetime, smsNumber, binding, objectLinks);

        // Handle request
        final SendableResponse<UpdateResponse> sendableResponse = registrationHandler.update(sender, updateRequest);
        UpdateResponse updateResponse = sendableResponse.getResponse();

        // Create CoAP Response from LwM2m request
        exchange.respond(fromLwM2mCode(updateResponse.getCode()), updateResponse.getErrorMessage());
        sendableResponse.sent();
    }