diff --git a/templates/content/agent_list.php b/templates/content/agent_list.php
index dc62598d40bc052a2053c81d3181667e401c2a81..6dbe0fdb25f02db9167dd936044d678c58366749 100644
--- a/templates/content/agent_list.php
+++ b/templates/content/agent_list.php
@@ -4,6 +4,8 @@
     $exportDirUserPath    = (isset($_['exportDirUserPath']) ? $_['exportDirUserPath'] : '');
     $msgList              = (isset($_['msgList']) ? $_['msgList'] : array());
 
+    $urlGenerator = OC::$server->getURLGenerator();
+
     // alert messages
     $htmlAlert = '';
     if (!empty($msgList)) {
@@ -46,10 +48,10 @@
         <?php if (!empty($htmlAlert)) { ?>
             <div id="dematpayslip_alert"><?php print $htmlAlert; ?></div>
         <?php } ?>
-        <h2><?php p($l->t('Liste des agents')); ?>&nbsp;&nbsp;<a href="<?php echo \OC\URLGenerator::linkToRoute('dematpayslip.page.agent_csv'); ?>" class="button" title="<?php p($l->t('Export CSV')); ?>"><?php p($l->t('CSV')); ?></a></h2>
+        <h2><?php p($l->t('Liste des agents')); ?>&nbsp;&nbsp;<a href="<?php echo $urlGenerator->linkToRoute('dematpayslip.page.agent_csv'); ?>" class="button" title="<?php p($l->t('Export CSV')); ?>"><?php p($l->t('CSV')); ?></a></h2>
 
         <div>
-            <a href="<?php echo \OC\URLGenerator::linkToRoute('files.view.index', ['dir' => $exportDirUserPath]); ?>" class="button" target="_blank" title="<?php p($l->t('Accéder aux exports CSV')); ?>"><?php p($l->t('Accéder aux exports CSV')); ?></a>
+            <a href="<?php echo $urlGenerator->linkToRoute('files.view.index', ['dir' => $exportDirUserPath]); ?>" class="button" target="_blank" title="<?php p($l->t('Accéder aux exports CSV')); ?>"><?php p($l->t('Accéder aux exports CSV')); ?></a>
         </div>
         <br />
 
@@ -74,10 +76,16 @@
                                 <tbody>
                                 <?php
                                     foreach ($dematpayslipUserList as $dematpayslipUser) {
+                                        $dematpayslipUserId = $dematpayslipUser->getUserId();
+                                        $dematpayslipUserDisplayName = $dematpayslipUserId;
+                                        $user = OC::$server->getUserManager()->get($dematpayslipUserId);
+                                        if ($user) {
+                                            $dematpayslipUserDisplayName = $user->getDisplayName();
+                                        }
                                         ?>
                                         <tr>
 <!--                                            <th>--><?php //print $dematpayslipUser->getUserId(); ?><!--</th>-->
-                                            <th scope="row"><?php print \OC::$server->getUserManager()->get($dematpayslipUser->getUserId())->getDisplayName(); ?></th>
+                                            <th scope="row"><?php print $dematpayslipUserDisplayName; ?></th>
                                             <td><?php print $dematpayslipUser->getSiret(); ?></td>
                                             <td><?php print $dematpayslipUser->getMatricule(); ?></td>
                                             <td><?php print $dematpayslipUser->getEmail(); ?></td>