NullPointer exception when trying to get file extension to determine how to upload photo/video

First i have created a simple class that stores possible extensions in a list for video and photo separately, then in my controller i tried to check first if file extensions matches png or jpeg before uploading as picture or if entensions matches mp4 etc

public class FileExtension {

    /**
     * short list of video file extensions
     * @return
     */
    private static List<String> videoExtensions() {

        List<String> lists = new ArrayList<>();
        lists.add("mp4");
        lists.add("m3u");
        lists.add("m3u8");
        lists.add("m4a");
        lists.add("m4p");
        lists.add("m4b");
        lists.add("m4r");
        lists.add("m4v");
        return lists;
    }

   private static List<String> videoExtList = new ArrayList<>(videoExtensions());

    /**
     * matcher for videos
     * @param ext
     * @return
     */
   static boolean matchVideoExt(String ext){
       return videoExtList.stream().anyMatch(ext::matches);
    }


    /**
     * short list of image extensions
     * @return
     */
    private static List<String> imageExtensions() {
        List<String> lists = new ArrayList<>();
        lists.add("png");
        lists.add("jpeg");
        lists.add("tiff");
        lists.add("gif");
        lists.add("bmp");
        lists.add("jfif");
        return lists;
    }

    private static List<String> imageExtList = new ArrayList<>(imageExtensions());

    /**
     * matcher for images
     * @param ext
     * @return
     */
    static boolean matchImageExt(String ext){
        return imageExtList.stream().anyMatch(ext::matches);
    }
}

And here is the controller

@Controller public class PostController {

@Autowired
private PhotosDao photosDao;

private static String UPLOADED_FOLDER = "/home/user/";




 @PostMapping("/feed")
    public String makeAPost(@ModelAttribute("post") Photo photo, Model model,
                            HttpServletRequest request,
                            HttpServletResponse response) {
        photo.setDate_created(LocalDate.now());
        photosDao.save(photo);

        if  //this is where i am getting the null pointer (on the if statement )(FileExtension.matchImageExt(photo.getImage().getOriginalFilename().split("\\.")[1])) {
            MultipartFile image = photo.getImage();
            try {
                byte[] bytes = image.getBytes();
                String name = photo.getId() + ".png";
                BufferedOutputStream stream =
                    new BufferedOutputStream(new FileOutputStream(new File(UPLOADED_FOLDER + name)));
                stream.write(bytes);
                stream.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        } else if (FileExtension.matchVideoExt(photo.getImage().getOriginalFilename().split("\\.")[1])) {
            try {
                MultipartFileSender.fromPath(Paths.get(UPLOADED_FOLDER))
                    .with(request)
                    .with(response)
                    .serveResource();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return "redirect:post";
    }

Can i get a suggestions probably a piece of code and is my approach ok ? also i amtrying to store both pictures and videos in a file located /home/user i am using linux

so for the stack trace when i click upload from my client it shows the internal server error

10:51:57.811 [http-nio-8081-exec-4] ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [/adminportal] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause
java.lang.NullPointerException: null
    at com.valentine.adminportal.controller.PostController.makeAPost(PostController.java:46)
    at com.valentine.adminportal.controller.PostController$$FastClassBySpringCGLIB$$8c701076.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684)
    at com.valentine.adminportal.controller.PostController$$EnhancerBySpringCGLIB$$e959d495.makeAPost(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:877)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:783)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:877)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.spr

so the NPE is shown to be at this line if (FileExtension.matchImageExt(photo.getImage().getOriginalFilename().split("\.")[1])) {