Minor HTML closing tag issue when uploading an image (buddypress)

I just checked my website on W3C validator https://validator.w3.org/ and I have an error that says

End tag ‘a’ violates nesting rules '<p></a></li>

I checked my website and this is the source code everytime I upload an image:

<div class="activity-inner">
    <div class="rtmedia-activity-container">
    <div class="rtmedia-activity-text">test text</div>
        <ul class="rtmedia-list rtm-activity-media-list rtmedia-activity-media-length-1">
            <li class="rtmedia-list-item media-type-photo">
                <a href="https://mysite.com/andym118/media/21/" rel="nofollow">
                    <div class="rtmedia-item-thumbnail">
                         <img alt="1" src="https://mysite.com/wp-content/uploads/rtMedia/users/1/2016/01/1.10-reina-tanaka-220x240.jpg" />
                    <div class="rtmedia-item-title">1</div>

As you can see, it keeps adding a <p> tag for no reason and without a closing </p> tag. Everything still works fine, it is just a html tag error.