|
|
@@ -75,8 +75,8 @@ exports.public = handleError(async (req, res) => {
|
|
|
.select(
|
|
|
'no_laporan pt.nama keterangan pelanggaran createdAt aktif role_data user'
|
|
|
)
|
|
|
- const user = await userModel.findById(laporan.user)
|
|
|
- if (!laporan || !user.isPublic) {
|
|
|
+ const user = laporan && (await userModel.findById(laporan.user))
|
|
|
+ if (!laporan || !user?.isPublic) {
|
|
|
return response.error(res, {
|
|
|
message: 'laporan tidak ada',
|
|
|
})
|